Spoonerize Me
Description:
A spoonerism is a spoken phrase in which the first letters of two of the words are swapped around, often with amusing results.
In its most basic form a spoonerism is a two word phrase in which only the first letters of each word are swapped:
"not picking" --> "pot nicking"
Your task is to create a function that takes a string of two words, separated by a space: words
and returns a spoonerism of those words in a string, as in the above example. A "word" in the context of this kata can contain any of the letters A
through Z
in upper or lower case, and the numbers 0
to 9
. Though spoonerisms are about letters in words in the domain of written and spoken language, numbers are included in the inputs for the random test cases and they require no special treatment.
NOTE: All input strings will contain only two words. Spoonerisms can be more complex. For example, three-word phrases in which the first letters of the first and last words are swapped: "pack of lies" --> "lack of pies"
or more than one letter from a word is swapped: "flat battery --> "bat flattery"
You are NOT expected to account for these, or any other nuances involved in spoonerisms.
Once you have completed this kata, a slightly more challenging take on the idea can be found here: http://www.codewars.com/kata/56dbed3a13c2f61ae3000bcd
Stats:
Created | Feb 8, 2016 |
Published | Mar 6, 2016 |
Warriors Trained | 10165 |
Total Skips | 141 |
Total Code Submissions | 14383 |
Total Times Completed | 6972 |
JavaScript Completions | 2742 |
Python Completions | 2478 |
C# Completions | 476 |
Java Completions | 919 |
Ruby Completions | 200 |
Julia Completions | 21 |
Rust Completions | 108 |
CoffeeScript Completions | 14 |
TypeScript Completions | 151 |
VB Completions | 68 |
R Completions | 23 |
C Completions | 66 |
COBOL Completions | 6 |
Total Stars | 87 |
% of votes with a positive feedback rating | 93% of 894 |
Total "Very Satisfied" Votes | 779 |
Total "Somewhat Satisfied" Votes | 105 |
Total "Not Satisfied" Votes | 10 |