544A.md (1444B)
1 Source: https://codeforces.com/problemset/problem/544/A 2 3 A. Set of Strings 4 5 time limit per test 6 7 1 second 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 standard input 16 17 output 18 19 standard output 20 21 You are given a string *q*. A sequence of *k* strings *s*1, *s*2, ..., *s**k* is called beautiful, if the concatenation of these strings is string *q* (formally, *s*1 + *s*2 + ... + *s**k* = *q*) and the first characters of these strings are distinct. 22 23 Find any beautiful sequence of strings or determine that the beautiful sequence doesn't exist. 24 25 Input 26 27 The first line contains a positive integer *k* (1 ≤ *k* ≤ 26) — the number of strings that should be in a beautiful sequence. 28 29 The second line contains string *q*, consisting of lowercase Latin letters. The length of the string is within range from 1 to 100, inclusive. 30 31 Output 32 33 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 *s*1, *s*2, ..., *s**k*. 34 35 If there are multiple possible answers, print any of them. 36 37 Examples 38 39 Input 40 41 ``` 42 1 43 abca 44 ``` 45 46 Output 47 48 ``` 49 YES 50 abca 51 ``` 52 53 Input 54 55 ``` 56 2 57 aaacas 58 ``` 59 60 Output 61 62 ``` 63 YES 64 aaa 65 cas 66 ``` 67 68 Input 69 70 ``` 71 4 72 abc 73 ``` 74 75 Output 76 77 ``` 78 NO 79 ``` 80 81 Note 82 83 In the second sample there are two possible answers: {"*aaaca*", "*s*"} and {"*aaa*", "*cas*"}.