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. docker --Dockerfile--一些语法

    环境更换 环境变量(与声明的ENV声明),也可以在特定指令作为变量用来被解释 Dockerfile.转义也被处理,从字面上包含类似于变量的语法. 环境变量Dockerfile用 $variable_n ...

  2. BZOJ3160 万径人踪灭(FFT+manacher)

    容易想到先统计回文串数量,这样就去掉了不连续的限制,变为统计回文序列数量. 显然以某个位置为对称轴的回文序列数量就是2其两边(包括自身)对称相等的位置数量-1.对称有啥性质?位置和相等.这不就是卷积嘛 ...

  3. hadoop MapReduce 入门

    原创播客,如需转载请注明出处.原文地址:http://www.cnblogs.com/crawl/p/7687120.html ------------------------------------ ...

  4. js md5 中文

    最近手机端通过js对请求数据加密,发现针对中文加密的结果和asp.net的webapi加密结果不一致 网上搜索了一下,发现以下js可用 function md5(string) { var x = A ...

  5. 查看本地Git仓库历史修改内容

    查看历史内容 在.git文件 同级目录下,右键 选择 git history 但是红框中的路径无法拷贝.右键红框中的任一文件,有 HighLight this only, Highlight this ...

  6. linux保存住github的账号和密码

    我是用 shell 命令来执行 git 操作的,所以就决定在 --global 配置一下用户名和密码,不用每次手动输入了. 设置步骤 1. 首先需要 ftp 连接到你的 Linux 服务器,在根目录( ...

  7. CodeForces - 669D

    题目链接:http://codeforces.com/problemset/problem/669/D Little Artem is fond of dancing. Most of all dan ...

  8. go vendor目录

    参考 https://blog.csdn.net/u010649766/article/details/80327035 那么查找依赖包路径的解决方案如下: 当前包下的vendor目录. 向上级目录查 ...

  9. 树莓派上使用mdk3对无线热点进行DoS攻击

    写在前面 你必须确保你的无线网卡支持监听模式(混淆模式),树莓派板载的无限网卡是不支持的.所以你必须额外安装一个支持监听模式的USB无线网卡. 安装mdk3 安装sudo apt install md ...

  10. UVA 1394 And Then There Was One / Gym 101415A And Then There Was One / UVAlive 3882 And Then There Was One / POJ 3517 And Then There Was One / Aizu 1275 And Then There Was One (动态规划,思维题)

    UVA 1394 And Then There Was One / Gym 101415A And Then There Was One / UVAlive 3882 And Then There W ...