codeforces-scrape

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

765B.md (1920B)


      1 Source: https://codeforces.com/problemset/problem/765/B
      2 
      3 B. Code obfuscation
      4 
      5 time limit per test
      6 
      7 2 seconds
      8 
      9 memory limit per test
     10 
     11 512 megabytes
     12 
     13 input
     14 
     15 standard input
     16 
     17 output
     18 
     19 standard output
     20 
     21 Kostya likes Codeforces contests very much. However, he is very disappointed that his solutions are frequently hacked. That's why he decided to obfuscate (intentionally make less readable) his code before upcoming contest.
     22 
     23 To obfuscate the code, Kostya first looks at the first variable name used in his program and replaces all its occurrences with a single symbol *a*, then he looks at the second variable name that has not been replaced yet, and replaces all its occurrences with *b*, and so on. Kostya is well-mannered, so he doesn't use any one-letter names before obfuscation. Moreover, there are at most 26 unique identifiers in his programs.
     24 
     25 You are given a list of identifiers of some program with removed spaces and line breaks. Check if this program can be a result of Kostya's obfuscation.
     26 
     27 Input
     28 
     29 In the only line of input there is a string *S* of lowercase English letters (1 ≤ |*S*| ≤ 500) — the identifiers of a program with removed whitespace characters.
     30 
     31 Output
     32 
     33 If this program can be a result of Kostya's obfuscation, print "YES" (without quotes), otherwise print "NO".
     34 
     35 Examples
     36 
     37 Input
     38 
     39 ```
     40 abacaba
     41 ```
     42 
     43 Output
     44 
     45 ```
     46 YES
     47 ```
     48 
     49 Input
     50 
     51 ```
     52 jinotega
     53 ```
     54 
     55 Output
     56 
     57 ```
     58 NO
     59 ```
     60 
     61 Note
     62 
     63 In the first sample case, one possible list of identifiers would be "number string number character number string number". Here how Kostya would obfuscate the program:
     64 
     65 * replace all occurences of number with a, the result would be "a string a character a string a",
     66 * replace all occurences of string with b, the result would be "a b a character a b a",
     67 * replace all occurences of character with c, the result would be "a b a c a b a",
     68 * all identifiers have been replaced, thus the obfuscation is finished.