codeforces-scrape

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

665C.md (1076B)


      1 Source: https://codeforces.com/problemset/problem/665/C
      2 
      3 C. Simple Strings
      4 
      5 time limit per test
      6 
      7 2 seconds
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 standard input
     16 
     17 output
     18 
     19 standard output
     20 
     21 zscoder loves simple strings! A string *t* is called simple if every pair of adjacent characters are distinct. For example ab, aba, zscoder are simple whereas aa, add are not simple.
     22 
     23 zscoder is given a string *s*. He wants to change a minimum number of characters so that the string *s* becomes simple. Help him with this task!
     24 
     25 Input
     26 
     27 The only line contains the string *s* (1 ≤ |*s*| ≤ 2·105) — the string given to zscoder. The string *s* consists of only lowercase English letters.
     28 
     29 Output
     30 
     31 Print the simple string *s*' — the string *s* after the minimal number of changes. If there are multiple solutions, you may output any of them.
     32 
     33 Note that the string *s*' should also consist of only lowercase English letters.
     34 
     35 Examples
     36 
     37 Input
     38 
     39 ```
     40 aab
     41 ```
     42 
     43 Output
     44 
     45 ```
     46 bab
     47 ```
     48 
     49 Input
     50 
     51 ```
     52 caaab
     53 ```
     54 
     55 Output
     56 
     57 ```
     58 cabab
     59 ```
     60 
     61 Input
     62 
     63 ```
     64 zscoder
     65 ```
     66 
     67 Output
     68 
     69 ```
     70 zscoder
     71 ```