Kamil
Time limit1sMemory limit128 MB
Given a word Kamil spoke, count the words he could have meant, since each position may map to one of several letters.
- Level
Easy2 of 10
- Topics
- Math, Combinatorics, Implementation
- Solved
- No attempts yet
Problem
Some children cannot pronounce every letter, and some pronounce the same letter correctly at one time and incorrectly at another. Kamil sometimes says T when he means K, but he never says K when he means T. In the same way, he sometimes says D instead of G. And instead of R he sometimes says L, and at other times F. Of course, he sometimes pronounces a letter correctly.
Kamil's father always wonders how many real words the word spoken by his son could stand for (he does not care whether those words actually exist).
Write a program that:
- reads the word spoken by Kamil from standard input,
- computes how many different words it could stand for,
- prints the result to standard output.
Input
The first and only line of input contains the non-empty word spoken by Kamil. For simplicity, assume the word consists only of uppercase letters of the English alphabet and has length at most 20.
Output
Print to standard output a single line containing a single integer: the number of different words that the word spoken by Kamil could stand for.