codeforces-scrape

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

774K.md (1623B)


      1 Source: https://codeforces.com/problemset/problem/774/K
      2 
      3 K. Stepan and Vowels
      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 Stepan likes to repeat vowel letters when he writes words. For example, instead of the word "pobeda" he can write "pobeeeedaaaaa".
     22 
     23 Sergey does not like such behavior, so he wants to write a program to format the words written by Stepan. This program must combine all consecutive equal vowels to a single vowel. The vowel letters are "a", "e", "i", "o", "u" and "y".
     24 
     25 There are exceptions: if letters "e" or "o" repeat in a row exactly 2 times, like in words "feet" and "foot", the program must skip them and do not transform in one vowel. For example, the word "iiiimpleeemeentatiioon" must be converted to the word "implemeentatioon".
     26 
     27 Sergey is very busy and asks you to help him and write the required program.
     28 
     29 Input
     30 
     31 The first line contains the integer *n* (1 ≤ *n* ≤ 100 000) — the number of letters in the word written by Stepan.
     32 
     33 The second line contains the string *s* which has length that equals to *n* and contains only lowercase English letters — the word written by Stepan.
     34 
     35 Output
     36 
     37 Print the single string — the word written by Stepan converted according to the rules described in the statement.
     38 
     39 Examples
     40 
     41 Input
     42 
     43 ```
     44 13  
     45 pobeeeedaaaaa
     46 ```
     47 
     48 Output
     49 
     50 ```
     51 pobeda
     52 ```
     53 
     54 Input
     55 
     56 ```
     57 22  
     58 iiiimpleeemeentatiioon
     59 ```
     60 
     61 Output
     62 
     63 ```
     64 implemeentatioon
     65 ```
     66 
     67 Input
     68 
     69 ```
     70 18  
     71 aeiouyaaeeiioouuyy
     72 ```
     73 
     74 Output
     75 
     76 ```
     77 aeiouyaeeioouy
     78 ```
     79 
     80 Input
     81 
     82 ```
     83 24  
     84 aaaoooiiiuuuyyyeeeggghhh
     85 ```
     86 
     87 Output
     88 
     89 ```
     90 aoiuyeggghhh
     91 ```