Advertisement blocking software were detected ;( Please add this webpage to whitelist.

KAMIL - Kamil

no tags 

Some kids cannot pronounce all letters, some of them they sometimes pronounce correctly and sometimes incorrectly. Kamil sometimes says T instead of K, but he never says K instead of T. Similarly he sometimes says D instead of G. Instead of R he sometimes says L and sometimes F. Of course it happens that he pronounces the letter correctly. Kamil's father always thinks how many words can mean the word spoken by his son (it doesn't matter if they are real English words).


Write a program which

  • reads from standard input the words spoken by Kamil
  • counts how many different words can that mean
  • writes the outcome on standard output



Ten test cases (given one under another, you have to process all!). Every test case is a single line - a word spoken by Kamil. Only 26 capital leters are used. The length of the word is at most 20.


For every testcase write an integer in a single line with a single integer, denoting the number of words which Kamil's word can mean.


The score awarded to your program is the number of bytes the source code you submit. The fewer points you score, the better. Submissions are not allowed to exceed 256 bytes.

Remark. It may turn out impossible to solve this problem in some languages.


[and 9 test cases more]

[and 9 test cases more]

Added by:Adam Dzedzej
Time limit:3s
Source limit:256B
Memory limit:1536MB
Cluster: Cube (Intel Pentium G860 3GHz)
Languages:All except: NODEJS objc PERL 6
Resource:Internet Contest Pogromcy Algorytmow (Algorithm Tamers) Round I, 2003

hide comments
vardhanharsh: 2015-08-19 15:47:46

exceeding source limit . what to do ?
Code in C#

ramky1107: 2015-07-18 08:39:38


ankur_gupta54: 2015-06-23 15:51:07

Can someone help me out... I am getting a compilation error while submission.. but when I compiling the code in other compiler there is no compilation error.

Mayank: 2015-05-28 16:19:54

85...happy :)

arun m dabbe: 2015-02-21 12:42:41

o/p is 4 because here condition is given that *for R he sometimes says L and **sometimes(means not always) F.
so filipek can become
riripek and
which counts to 4.

Learner: 2015-01-14 04:03:59

pls. provide some more test case...

jjagadish: 2015-01-08 14:46:23

Can someone explain why is output 4?

Last edit: 2015-01-08 14:51:59
Flago: 2014-12-09 13:46:30

@php users :

When I try to create an array containing letters, lets say 'A', 'B', 'C', 'D', 'E', 'F', all the following code work on ideone, but the last one is not working on SPOJ (NZEC):

<?php print_r(array(A,B,C,D,E,F)); ?>
<?php print_r(str_split(ABCDEF)); ?>
<?php print_r([A,B,C,D,E,F]); ?>

Any idea why ?

udaykiran: 2014-09-18 12:08:55

can any one tell me how output is 4

Miroslav Kovar: 2014-08-02 23:33:48

Throws segfault on the server, runs fine locally... Why?