Codeforces Round #293 (Div. 2) A. Vitaly and Strings

5004 단어 codeforces

제목 주소:http://codeforces.com/contest/518/problem/A
 1 /*  2    :     s,t,      :s < r < t  r     3  4        ,  s < t,    t          s       5          1   , "  " 1,   0,    1  6  !strcmp (t, s):  t < s    t > s (   )   ,t == s    NO  7 */  8 #include <cstdio>  9 #include <iostream> 10 #include <cstring> 11 #include <string> 12 #include <algorithm> 13 #include <cmath> 14 #include <vector> 15 #include <map> 16 #include <set> 17 using namespace std; 18 19 const int MAXN = 1e6 + 10; 20 const int INF = 0x3f3f3f3f; 21 22 int main(void) 23 { 24 //freopen ("A.in", "r", stdin); 25 26 char s[110], t[110]; 27 28 while (~scanf ("%s %s", &s, &t)) 29  { 30 int cnt = strlen (s) - 1; 31 while (t[cnt] == 'a' && cnt >= 0) 32  { 33 t[cnt] = 'z'; 34 cnt--; 35  } 36 t[cnt]--; 37 (!strcmp (t, s)) ? puts ("No such string") : printf ("%s
", t); 38 } 39 40 return 0; 41 }

좋은 웹페이지 즐겨찾기