6 kyu

The Vowel Code

9,093 of 21,731yaphi1

Description:

Step 1: Create a function called encode() to replace all the lowercase vowels in a given string with numbers according to the following pattern:

a -> 1
e -> 2
i -> 3
o -> 4
u -> 5

For example, encode("hello") would return "h2ll4". There is no need to worry about uppercase vowels in this kata.

Step 2: Now create a function called decode() to turn the numbers back into vowels according to the same pattern shown above.

For example, decode("h3 th2r2") would return "hi there".

For the sake of simplicity, you can assume that any numbers passed into the function will correspond to vowels.

Arrays
Strings
Regular Expressions
Fundamentals

Stats:

CreatedMay 7, 2014
PublishedMay 7, 2014
Warriors Trained31140
Total Skips2487
Total Code Submissions55059
Total Times Completed21731
JavaScript Completions9093
Python Completions9296
Ruby Completions571
C Completions657
C++ Completions2057
NASM Completions32
TypeScript Completions312
Groovy Completions13
Shell Completions41
Total Stars441
% of votes with a positive feedback rating93% of 2187
Total "Very Satisfied" Votes1888
Total "Somewhat Satisfied" Votes270
Total "Not Satisfied" Votes29
Ad
Contributors
  • yaphi1 Avatar
  • jhoffner Avatar
  • SagePtr Avatar
  • anter69 Avatar
  • B1ts Avatar
  • rowcased Avatar
  • FArekkusu Avatar
  • uniapi Avatar
  • albertogcmr Avatar
  • StepBack13 Avatar
  • Just4FunCoder Avatar
  • ghnoob Avatar
  • FranzMartyn Avatar
  • saudiGuy Avatar
Ad