wes d2a2ba9e15 first commit 4 년 전
..
README.md d2a2ba9e15 first commit 4 년 전
code.cpp d2a2ba9e15 first commit 4 년 전
unitTest.cpp d2a2ba9e15 first commit 4 년 전

README.md

Spoonerisms

by Matt tags: strings, conditions

Summary

A spoonerism is when the first letters / sounds of two words are transposed onto one another. Create a function that takes a two-word string and performs a spoonerism on the phrase. Examples spoonerise("history lecture") ➞ "listory hecture" spoonerise("loud noises") ➞ "noud loises" spoonerise("chow mein") ➞ "mow chein" spoonerise("edabit rules!") ➞ "redabi

Instructions

A spoonerism is when the first letters / sounds of two words are transposed onto one another. Create a function that takes a two-word string and performs a spoonerism on the phrase.

Examples

spoonerise("history lecture") ➞ "listory hecture"

spoonerise("loud noises") ➞ "noud loises"

spoonerise("chow mein") ➞ "mow chein"

spoonerise("edabit rules!") ➞ "redabit ules!"

Notes

  • Only two words will be parsed into the function. Don't worry about handling more than two.
  • You won't always just have to swap the first letters, take care to notice which letters have been switched in the examples (notice the difference between vowel-starting and consonant-starting words).