Files
wehub-resource-sync dde272c4b8
i18n - Build Validation / Validate i18n Builds (24) (push) Has been cancelled
CI - Node.js / Lint (24) (push) Has been cancelled
CI - Node.js / Build (24) (push) Has been cancelled
CI - Node.js / Test (24) (push) Has been cancelled
CI - Node.js / Test - Upcoming Changes (24) (push) Has been cancelled
CI - Node.js / Test - i18n (italian, 24) (push) Has been cancelled
CI - Node.js / Test - i18n (portuguese, 24) (push) Has been cancelled
CD - Docker - GHCR Images / Build and Push Images (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 11:55:53 +08:00

2.1 KiB

id, title, challengeType, dashedName
id title challengeType dashedName
68adce01c0e1144d0a902956 Challenge 25: Vowel Repeater 29 challenge-25

--description--

Given a string, return a new version of the string where each vowel is duplicated one more time than the previous vowel you encountered. For instance, the first vowel in the sentence should remain unchanged. The second vowel should appear twice in a row. The third vowel should appear three times in a row, and so on.

  • The letters a, e, i, o, and u, in either uppercase or lowercase, are considered vowels.
  • The original vowel should keeps its case.
  • Repeated vowels should be lowercase.
  • All non-vowel characters should keep their original case.

--hints--

repeat_vowels("hello world") should return "helloo wooorld".

({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(repeat_vowels("hello world"), "helloo wooorld")`)
}})

repeat_vowels("freeCodeCamp") should return "freeeCooodeeeeCaaaaamp".

({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(repeat_vowels("freeCodeCamp"), "freeeCooodeeeeCaaaaamp")`)
}})

repeat_vowels("AEIOU") should return "AEeIiiOoooUuuuu".

({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(repeat_vowels("AEIOU"), "AEeIiiOoooUuuuu")`)
}})

repeat_vowels("I like eating ice cream in Iceland") should return "I liikeee eeeeaaaaatiiiiiing iiiiiiiceeeeeeee creeeeeeeeeaaaaaaaaaam iiiiiiiiiiin Iiiiiiiiiiiiceeeeeeeeeeeeelaaaaaaaaaaaaaand".

({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(repeat_vowels("I like eating ice cream in Iceland"), "I liikeee eeeeaaaaatiiiiiing iiiiiiiceeeeeeee creeeeeeeeeaaaaaaaaaam iiiiiiiiiiin Iiiiiiiiiiiiceeeeeeeeeeeeelaaaaaaaaaaaaaand")`)
}})

--seed--

--seed-contents--

def repeat_vowels(s):

    return s

--solutions--

def repeat_vowels(s):
    vowels = "aeiouAEIOU"
    count = 0
    result = []

    for char in s:
        result.append(char)
        if char in vowels:
            result.append(char.lower() * count)
            count += 1

    return "".join(result)