# Code Kata Nr. 5

This week we returned to the world of strings and realistic programming (more or less). The kata itself is a slightly modified variant of the well known Soundex algorithm. (see a detailed description of Soundex algorithm here: http://en.wikipedia.org/wiki/Soundex)

And now the actual exercise we had:

• The algorithm receives a name as input, which is at least two characters long
• Retain the first letter of the name, and drop all occurrences of a, e, h, i, o, u, w, y in other positions.
• If two or more letters are the same on adjacent positions in the name, omit all but the first.
• Here we get a little tricky and diverge from the original algorithm: convert all the resulting string to all-uppercase
• Convert all letters (but the first) to ASCII characters
• Back to the original algorithm: convert the resulting string to the form LETTER NUMBER NUMBER NUMBER (note that NUMBER is an ASCII character of two digits)
• If there are not enough characters in the string, use the number “00” instead

Why was it needed to modify the algorithm to something that does not really do anything useful? Well it was required because of the nature of the katas; we play them the following way:

1. The problem is presented
2. We have a first round of x minutes, when the players can implement their solution employing TDD
3. After that we have a discussion round when everyone tells the others what and how did they do
4. All the solutions are erased
5. A second round comes of x minutes again, where everyone can use ideas or parts of others’ solution

This kata was played with 20 minutes long rounds. If the character grouping had been a constraint, we would have spent all the time testing that all the characters are grouped properly. The checking of the banned characters took too much time anyway. If you play katas differently (longer rounds, or no rounds at all, no time constraint), then just add this requirement too, and implement the whole algorithm (have fun and see its limitations :-)).

There was no new constraint introduced, but all the previous ones remained valid.