Want to solve this problem? Login now to get access to solve the problems
It is guaranteed that the input string is special.
Line 1 : Two integers, N and P (separated by space) Line 2 : String S
Next special string or "NO"
1 <= N <= 1000 1 <= P <= 26 String S contains only lowercase letters i.e [a-z]
3 3 cba
3 4 cba
4 4 abcd