A. Word Correction

Codeforces
IDCF938A
Time1000ms
Memory256MB
Difficulty
implementation
English · Original
Chinese · Translation
Formal · Original
Victor tries to write his own text editor, with word correction included. However, the rules of word correction are really strange. Victor thinks that if a word contains two **consecutive** vowels, then it's kinda weird and it needs to be replaced. So the word corrector works in such a way: as long as there are two consecutive vowels in the word, it deletes the first vowel in a word such that there is **another vowel right before it**. If there are no two consecutive vowels in the word, it is considered to be correct. You are given a word _s_. Can you predict what will it become after correction? **In this problem letters _a_, _e_, _i_, _o_, _u_ and _y_ are considered to be vowels**. ## Input The first line contains one integer _n_ (1 ≤ _n_ ≤ 100) — the number of letters in word _s_ before the correction. The second line contains a string _s_ consisting of exactly _n_ lowercase Latin letters — the word before the correction. ## Output Output the word _s_ after the correction. [samples] ## Note Explanations of the examples: 1. There is only one replace: w**ei**rd werd; 2. No replace needed since there are no two consecutive vowels; 3. **aa**eaa **ae**aa **aa**a **aa** a.
Victor 试图编写自己的文字编辑器,并包含单词校正功能。然而,单词校正的规则非常奇怪。 Victor 认为,如果一个单词包含两个 *连续* 的元音字母,那么它就是奇怪的,需要被替换。因此,单词校正器的工作方式如下:只要单词中存在两个连续的元音字母,就删除第一个元音字母,该元音字母的前一个字母也必须是元音字母。如果单词中没有两个连续的元音字母,则认为它是正确的。 给你一个单词 #cf_span[s]。你能预测它在校正后会变成什么吗? *在本题中,字母 a、e、i、o、u 和 y 被视为元音字母*。 第一行包含一个整数 #cf_span[n] (#cf_span[1 ≤ n ≤ 100]) —— 校正前单词 #cf_span[s] 中的字母数量。 第二行包含一个由恰好 #cf_span[n] 个小写拉丁字母组成的字符串 #cf_span[s] —— 校正前的单词。 请输出校正后的单词 #cf_span[s]。 ## Input 第一行包含一个整数 #cf_span[n] (#cf_span[1 ≤ n ≤ 100]) —— 校正前单词 #cf_span[s] 中的字母数量。 第二行包含一个由恰好 #cf_span[n] 个小写拉丁字母组成的字符串 #cf_span[s] —— 校正前的单词。 ## Output 请输出校正后的单词 #cf_span[s]。 [samples] ## Note 示例解释: 只进行一次替换:w*ei*rd → werd; 无需替换,因为不存在两个连续的元音字母; *aa*eaa → *ae*aa → *aa*a → *aa* → a。
**Definitions** Let $ n \in \mathbb{Z} $ be the length of the string. Let $ s = s_1 s_2 \dots s_n $ be a string over the alphabet of lowercase Latin letters. Define the set of vowels: $ V = \{a, e, i, o, u, y\} $. **Constraints** $ 1 \leq n \leq 100 $ **Objective** Repeatedly apply the following operation until no two consecutive vowels exist: Find the smallest index $ i \in \{1, \dots, n-1\} $ such that $ s_i \in V $ and $ s_{i+1} \in V $, and delete $ s_i $. Output the resulting string.
Samples
Input #1
5
weird
Output #1
werd
Input #2
4
word
Output #2
word
Input #3
5
aaeaa
Output #3
a
API Response (JSON)
{
  "problem": {
    "name": "A. Word Correction",
    "description": {
      "content": "Victor tries to write his own text editor, with word correction included. However, the rules of word correction are really strange. Victor thinks that if a word contains two **consecutive** vowels, t",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF938A"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Victor tries to write his own text editor, with word correction included. However, the rules of word correction are really strange.\n\nVictor thinks that if a word contains two **consecutive** vowels, t...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "Victor 试图编写自己的文字编辑器,并包含单词校正功能。然而,单词校正的规则非常奇怪。\n\nVictor 认为,如果一个单词包含两个 *连续* 的元音字母,那么它就是奇怪的,需要被替换。因此,单词校正器的工作方式如下:只要单词中存在两个连续的元音字母,就删除第一个元音字母,该元音字母的前一个字母也必须是元音字母。如果单词中没有两个连续的元音字母,则认为它是正确的。\n\n给你一个单词 #cf_spa...",
      "is_translate": true,
      "language": "Chinese"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ n \\in \\mathbb{Z} $ be the length of the string.  \nLet $ s = s_1 s_2 \\dots s_n $ be a string over the alphabet of lowercase Latin letters.  \nDefine the set of vowels: $ V = \\{a,...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments