codeforces-scrape

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

858C.md (2044B)


      1 Source: https://codeforces.com/problemset/problem/858/C
      2 
      3 C. Did you mean...
      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 standard input
     16 
     17 output
     18 
     19 standard output
     20 
     21 Beroffice text editor has a wide range of features that help working with text. One of the features is an automatic search for typos and suggestions of how to fix them.
     22 
     23 Beroffice works only with small English letters (i.e. with 26 letters from a to z). Beroffice thinks that a word is typed with a typo if there are three or more consonants in a row in the word. The only exception is that if the block of consonants has all letters the same, then this block (even if its length is greater than three) is not considered a typo. Formally, a word is typed with a typo if there is a block of not less that three consonants in a row, and there are at least two different letters in this block.
     24 
     25 For example:
     26 
     27 * the following words have typos: "hellno", "hackcerrs" and "backtothefutttture";
     28 * the following words don't have typos: "helllllooooo", "tobeornottobe" and "oooooo".
     29 
     30 When Beroffice editor finds a word with a typo, it inserts as little as possible number of spaces in this word (dividing it into several words) in such a way that each of the resulting words is typed without any typos.
     31 
     32 Implement this feature of Beroffice editor. Consider the following letters as the only vowels: 'a', 'e', 'i', 'o' and 'u'. All the other letters are consonants in this problem.
     33 
     34 Input
     35 
     36 The only line contains a non-empty word consisting of small English letters. The length of the word is between 1 and 3000 letters.
     37 
     38 Output
     39 
     40 Print the given word without any changes if there are no typos.
     41 
     42 If there is at least one typo in the word, insert the minimum number of spaces into the word so that each of the resulting words doesn't have any typos. If there are multiple solutions, print any of them.
     43 
     44 Examples
     45 
     46 Input
     47 
     48 ```
     49 hellno
     50 ```
     51 
     52 Output
     53 
     54 ```
     55 hell no
     56 ```
     57 
     58 Input
     59 
     60 ```
     61 abacaba
     62 ```
     63 
     64 Output
     65 
     66 ```
     67 abacaba
     68 ```
     69 
     70 Input
     71 
     72 ```
     73 asdfasdf
     74 ```
     75 
     76 Output
     77 
     78 ```
     79 asd fasd f
     80 ```