func_code_string: #include <bits/stdc++.h>   using namespace std;   template <class T>   void in(T &x) {     x = 0;     bool f = 0;     char c = getchar();     while (c <  0  || c >  9 ) {       if (c ==  - ) f = 1;       c = getchar();     }     while ( 0  <= c && c <=  9 ) {       x = (x << 3) + (x << 1) + (c ^ 48);       c = getchar();     }     if (f) x = -x;   }   char s[1005];   int n, p;   char can(int x) {     for (register int i = s[x] + 1; i <=  a  + p - 1; ++i)       if (i != s[x - 1] && i != s[x - 2]) return i;     return 0;   }   signed main() {     in(n), in(p);     scanf( %s , s + 1);     int pos = 0;     for (register int i = n; i >= 1; --i) {       if (can(i)) {         s[i] = can(i);         pos = i;         break;       }     }     if (!pos) {       puts( NO );       return 0;     }     for (register int i = pos + 1; i <= n; ++i) {       for (register int j =  a ; j <=  a  + p - 1; ++j)         if (j != s[i - 1] && j != s[i - 2]) {           s[i] = j;           break;         }     }     for (register int i = 1; i <= n; ++i) putchar(s[i]);     return 0;   }   