My little daughter is learning how to talk. Talking is a hard challenge though. Especially the consonants give her a hard time! Therefore, she creates her own childspeak. After some time, we started to notice some rules of it:
- She uses exactly one unique consonant in the word—once she comes to the first consonants, she replaces all the subsequent consonants with the first one. Example: instead of "mapa", she says "mama".
- If the word starts with a vowel, she puts the first consonant to the very beginning, so instead of "alibaba" she says "lalilala".
- If there is a group of consecutive consonants, she replaces the whole group with just a single consonant. For example instead of "lampa", she says "lala", instead of "bratislava" she says "babibaba".
- If there is a group of consecutive vowels, she replaces that group with the last vowel from the group. So instead of "naomi" she says "noni", instead of "aikido" she says "kikiko" ("ai" was replaced by "i" and prepended by "k", because of the 2nd rule)
- She ignores all the consonants after the last vowel, so instead of "ahoj" she says "haho".
Understanding such a childspeak is a demanding task, especially because many words' pronunciation is the same.
In this task, you’ll be given a list of all the words that matter. Your job is for each word to calculate, how many other words (from the same list) have the same pronunciation in my daughter’s childspeak.
mapa alan island lampa lajdak alan mama
alan 2 island 0 lajdak 2 lampa 2 mama 1 mapa 1