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 1 to 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.

Examples

Input

1
abca

Output

YES
abca

Input

2
aaacas

Output

YES
aaa
cas

Input

4
abc

Output

NO

Note

In the second sample there are two possible answers: {"aaaca", "s"} and {"aaa", "cas"}.

#include<iostream>

#include<string>

#include<cstring>

#include<map>

#include<queue>

using namespace std;

map<char,int >wakaka;

int a[1010];

int main()

{

    int n;

    cin>>n;

    memset(a,0,sizeof(a));

    string s;

    cin>>s;

    int len=s.size();

    if(len<n)

    {

        cout<<"NO"<<endl;

    }

    else

    {

        a[0]=0;

        int ans=0;

        for(int i=0; i<len; i++)

        {

            if(wakaka[s[i]]==0)

            {

                ans++;

                a[ans]=i;

            }

            wakaka[s[i]]++;

        }

        if(ans>=n)

        {

            cout<<"YES"<<endl;

            for(int i=1; i<=ans; i++)

            {

                if(i==n)

                {

                    for(int j=a[i]; j<len; j++)

                    {

                        cout<<s[j];

                    }

                    break;

                }

                for(int j=a[i]; j<a[i+1]; j++)

                {

                    cout<<s[j];

                }

                cout<<endl;

            }

        }

        else

        {

            cout<<"NO"<<endl;

        }

    }

    return 0;

}

F - Set of Strings的更多相关文章

  1. Codeforces Round #598 (Div. 3) F. Equalizing Two Strings 构造

    F. Equalizing Two Strings You are given two strings s and t both of length n and both consisting of ...

  2. Codeforces Round #598 (Div. 3) F. Equalizing Two Strings

    You are given two strings ss and tt both of length nn and both consisting of lowercase Latin letters ...

  3. golang --strings 下常用函数api

    1. func Compare(a, b string) int {} 比较返回一个按字典顺序比较两个字符串的整数.如果a == b则结果为0,如果a <b则结果为-1,如果a> b则结果 ...

  4. Equalizing Two Strings

    F. Equalizing Two Strings 有几种情况可以直接判定结果: ① 字母对应个数不一样,可直接判NO ② 当不满足①时,如果有一个字母有2个及以上的个数,也可直接判YES ③ 当不满 ...

  5. float_array.go

    )         if err != nil {             log.Fatalf("Could not parse: %s", s)             ret ...

  6. JavaSE_List&Array_Java1.7

    这里简单写了下List和Array的相互转换 package cn.rocker.collection.list; import org.junit.Test; import java.util.Ar ...

  7. 驳2B文 "我为什么放弃Go语言"

      此篇文章流传甚广, 其实里面没啥干货, 而且里面很多观点是有问题的. 这个文章在 golang-china 很早就讨论过了. 最近因为 Rust 1.0 和 1.1 的发布, 导致这个文章又出来毒 ...

  8. [日常] Go语言圣经-错误,函数值习题

    Go语言圣经-错误 1.panic异常.panic是来自被调函数的信号,表示发生了某个已知的bug 2.任何进行I/O操作的函数都会面临出现错误的可能 3.错误是软件包API和应用程序用户界面的一个重 ...

  9. AtCoder Regular Contest

    一句话题解 因为上篇AGC的写的有点长……估计这篇也短不了所以放个一句话题解方便查阅啥的吧QwQ 具体的题意代码题解还是往下翻…… ARC 058 D:简单容斥计数. E:用二进制表示放的数字,然后状 ...

随机推荐

  1. Codeforces ECR47F Dominant Indices(线段树合并)

    一个比较显然的做法:对每棵子树用线段树维护其中的深度,线段树合并即可. 本来想用这个题学一下dsu on tree,结果还是弃疗了. #include<iostream> #include ...

  2. wamp下var_dump()相关问题

    PHP 使用var_dump($arr)时 没有格式化输出. 原因是没有启用‘XDebug’扩展 [xdebug]zend_extension ="d:/wamp/bin/php/php7. ...

  3. Codeforces960G Bandit Blues 【斯特林数】【FFT】

    题目大意: 求满足比之前的任何数小的有A个,比之后的任何数小的有B个的长度为n的排列个数. 题目分析: 首先写出递推式,设s(n,k)表示长度为n的排列,比之前的数小的数有k个. 我们假设新加入的数为 ...

  4. String的实例化与static final修饰符

    String两种实例化方式 一种是通过双引号直接赋值的方式,另外一种是使用标准的new调用构造方法完成实例化.如下: String str = "abcd"; String str ...

  5. 洛谷 P4127 [AHOI2009]同类分布 解题报告

    P4127 [AHOI2009]同类分布 题目描述 给出两个数\(a,b\),求出\([a,b]\)中各位数字之和能整除原数的数的个数. 说明 对于所有的数据,\(1 ≤ a ≤ b ≤ 10^{18 ...

  6. Android在初始化时弹出popwindow的方法

     http://blog.csdn.net/sxsboat/article/details/7340759 Android中在onCreate()时弹出popwindow,很多人都有过类似的需求吧,但 ...

  7. max,min,Zip函数(十一)

    zip函数,拉链,传两个有序的参数,将他们一一对应为元祖形式 max,min比较默认比较一个元素,处理的是可迭代对象,相当于for循环取出每个元素进行比较,注意:不同类型之间不可比较 #!/usr/b ...

  8. Struts2中遇到的问题

    问题1: 最近在学习的时候用到了Struts2.5,在一系列操作之后Tomcat部署成功了,然而之后在测试的时候却出现了问题,网页无法正常响应,并且报出了Wrong method was define ...

  9. Ubuntu 16.04配置VNC进行远程桌面连接

    1.安装 $sudo apt-get install xfce4 $sudo apt-get install vnc4server $sudo apt-get install xrdp 2.启动vnc ...

  10. 面向对象【day08】:反射(五)

    本节内容 概述 反射函数 综合使用 一.概述 反射我们以后会经常用到,这个东西实现了动态的装配,通过字符串来反射类中的属性和方法 二.反射函数 2.1 hasarttr(obj,name_str) 作 ...