wes d2a2ba9e15 first commit 4 anni fa
..
README.md d2a2ba9e15 first commit 4 anni fa
code.cpp d2a2ba9e15 first commit 4 anni fa
unitTest.cpp d2a2ba9e15 first commit 4 anni fa

README.md

Replace Letters With Position In Alphabet

by Helen Yu tags: strings, formatting

Summary

Create a function that takes a string and replaces each letter with its appropriate position in the alphabet. "a" is 1, "b" is 2, "c" is 3, etc, etc. Examples alphabetIndex("Wow, does that work?") ➞ "23 15 23 4 15 5 19 20 8 1 20 23 15 18 11" alphabetIndex("The river stole the gods.") ➞ "20 8 5 18 9 22 5 18 19 20 15 12 5 20 8 5 7 15 4 19" alphabetIndex("We h

Instructions

Create a function that takes a string and replaces each letter with its appropriate position in the alphabet. "a" is 1, "b" is 2, "c" is 3, etc, etc.

Examples

alphabetIndex("Wow, does that work?")
➞ "23 15 23 4 15 5 19 20 8 1 20 23 15 18 11"

alphabetIndex("The river stole the gods.")
➞ "20 8 5 18 9 22 5 18 19 20 15 12 5 20 8 5 7 15 4 19"

alphabetIndex("We have a lot of rain in June.")
➞ "23 5 8 1 22 5 1 12 15 20 15 6 18 1 9 14 9 14 10 21 14 5"

Notes

If any character in the string isn't a letter, ignore it.