Daily Challenge #31

Next Letters

Create a procedure that takes a parameter, modifies it and returns using this algorithm:

  1. Replaces every letter in the string with the next letter in alphabet (e.g. c becomes d, z becomes a).
  2. Checks modified string and determine if it contains vowels (a, e, i, o, u) and if so, capitalizes the vowels.

Examples:

nextLetters(hello3) -> Ifmmp3
nextLetters(fun times!) -> gvO Ujnft!

6 Likes

Somehow I am able to do it :sweat_smile:

4 Likes

Great. Show output also

1 Like

Here it is:

2 Likes

Great job @vknow360 . Also, take a look at below. Does that give you (or others) idea for other possible solutions?

image

1 Like

Look up in pairs?

1 Like

@Italo Block below is only for purpose of illustration and needs fine-tuning.
Basically, lookup the character in list1. If it exists, using FOUND-index, get its associated entry in list2 Notice that list2 is one-off from list1

2 Likes

Very clever solution!

Also I didn’t think of using look up in pairs. It allows you to change the coding to something totally random every time you want.

I also like how @vknow360 coded a whole procedure without using the look up in pairs block. It helps develop the coding skills.

3 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.