CF Set of Strings

Set of Strings
time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

You are given a string q. A sequence of k strings s1, s2, ..., sk is called beautiful, if the concatenation of these strings is string q (formally, s1 + s2 + ... + sk = q) and the first characters of these strings are distinct.

Find any beautiful sequence of strings or determine that the beautiful sequence doesn't exist.

Input

The first line contains a positive integer k (1 ≤ k ≤ 26) — the number of strings that should be in a beautiful sequence.

The second line contains string q, consisting of lowercase Latin letters. The length of the string is within range from 1to 100, inclusive.

Output

If such sequence doesn't exist, then print in a single line "NO" (without the quotes). Otherwise, print in the first line "YES" (without the quotes) and in the next k lines print the beautiful sequence of strings s1, s2, ..., sk.

If there are multiple possible answers, print any of them.

Sample test(s)
input
1
abca
output
YES
abca
input
2
aaacas
output
YES
aaa
cas
input
4
abc
output
NO
 #include <cstdio>
#include <iostream>
#include <algorithm>
#include <queue>
#include <cstring>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <map>
#include <ctime>
using namespace std; bool VIS[];
int main(void)
{
char q[];
int a,num;
int loc[];
num = ; scanf("%d",&a);
scanf("%s",q);
for(int i = ;q[i];i ++)
if(!VIS[q[i]])
{
VIS[q[i]] = true;
loc[num] = i;
num ++;
}
loc[num] = strlen(q); if(num < a)
puts("NO");
else
{
puts("YES");
for(int i = ;i < a;i ++)
{
if(i == a - )
for(int j = loc[i];q[j];j ++)
printf("%c",q[j]);
else
for(int j = loc[i];j < loc[i + ];j ++)
printf("%c",q[j]);
puts("");
}
} return ;
}
上一篇:构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(4)-构建项目解决方案 创建EF DataBase Frist模式


下一篇:【转】怎样查出SQLServer的性能瓶颈