Want to solve this problem? Login now to get access to solve the problems

Problem

Submissions

Solution

Leaderboard

Coming soon

0

Difficulty: MEDIUM

Avg. time to solve

25 min

Success Rate

75%

Problem Statement

Suggest Edit

```
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
```

```
NO
```

```
3 4
cba
```

```
cbd
```

```
4 4
abcd
```

```
abda
```

Want to solve this problem? Login now to get access to solve the problems