codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

518A.md (1923B)


      1 Source: https://codeforces.com/problemset/problem/518/A
      2 
      3 A. Vitaly and 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 stdin
     16 
     17 output
     18 
     19 stdout
     20 
     21 Vitaly is a diligent student who never missed a lesson in his five years of studying in the university. He always does his homework on time and passes his exams in time.
     22 
     23 During the last lesson the teacher has provided two strings *s* and *t* to Vitaly. The strings have the same length, they consist of lowercase English letters, string *s* is lexicographically smaller than string *t*. Vitaly wondered if there is such string that is lexicographically larger than string *s* and at the same is lexicographically smaller than string *t*. This string should also consist of lowercase English letters and have the length equal to the lengths of strings *s* and *t*.
     24 
     25 Let's help Vitaly solve this easy problem!
     26 
     27 Input
     28 
     29 The first line contains string *s* (1 ≤ |*s*| ≤ 100), consisting of lowercase English letters. Here, |*s*| denotes the length of the string.
     30 
     31 The second line contains string *t* (|*t*| = |*s*|), consisting of lowercase English letters.
     32 
     33 It is guaranteed that the lengths of strings *s* and *t* are the same and string *s* is lexicographically less than string *t*.
     34 
     35 Output
     36 
     37 If the string that meets the given requirements doesn't exist, print a single string "No such string" (without the quotes).
     38 
     39 If such string exists, print it. If there are multiple valid strings, you may print any of them.
     40 
     41 Examples
     42 
     43 Input
     44 
     45 ```
     46 a  
     47 c
     48 ```
     49 
     50 Output
     51 
     52 ```
     53 b
     54 ```
     55 
     56 Input
     57 
     58 ```
     59 aaa  
     60 zzz
     61 ```
     62 
     63 Output
     64 
     65 ```
     66 kkk
     67 ```
     68 
     69 Input
     70 
     71 ```
     72 abcdefg  
     73 abcdefh
     74 ```
     75 
     76 Output
     77 
     78 ```
     79 No such string
     80 ```
     81 
     82 Note
     83 
     84 String *s* = *s*1*s*2... *s**n* is said to be lexicographically smaller than *t* = *t*1*t*2... *t**n*, if there exists such *i*, that *s*1 = *t*1, *s*2 = *t*2, ... *s**i* - 1 = *t**i* - 1, *s**i* < *t**i*.