DWITE Online Computer Programming Contest

Pattern Matching

November 2010
Problem 1

Creating a random name generator is not an easy task. There are so many factors to consider, like the origin of the name, the length of the name, etc... In fact, you would also like to know the structure of words used. Here, the ‘structure’ of a word is the pattern of vowels and consonants. For example, the structure of ‘DWITE’ would be (consonant, consonant, vowel, consonant, vowel). Given pairs of names generated by the random name generator, determine if the names have the same structure or not.

The input file DATA1.txt will contain 5 lines, each being no more than 256 characters in length, and comprising two lowercase strings separated by a single space.

The output file OUT1.txt will contain 5 lines of output, each being the result of comparing the “structure” of the pair of words, either same or different.

Note: For the purposes of this question, the letter Y is considered as a consonant.

Sample Input (first 3 shown):
green train
dwite rocks
november canada
Sample Output (first 3 shown):
same
different
different