ZOJ Problem Set - 2947
When a Little White meets another Little White:
Little White A: (Surprised) !
------quote from qmd of Spade6 in CC98 forum.
Sometimes, we write the abbreviation of a name. For example IBM is the abbreviation for International Business Machines. A name usually consists of one or more words. A word begins with a capital letter ('A' - 'Z') and followed by zero or more lower-case letters ('a' - 'z'). The abbreviation for a name is the word that consists of all the first letters of the words.
Now, you are given two names and asked to decide whether their abbreviations are the same.
Standard input will contain multiple test cases. The first line of the input is a single integer T which is the number of test cases. And it will be followed by T consecutive test cases.
There are four lines for each case.
Results should be directed to standard output. The output of each test case should be a single line. If two names' abbreviations are the same, output "SAME", otherwise output "DIFFERENT".
3 4 Super Harddisc Drive Cooler 4 Spade Heart Diamond Club 3 Shen Guang Hao 3 Shuai Ge Hao 3 Cai Piao Ge 4 C P C S
SAME SAME DIFFERENT
Author: HANG, Hang
Source: Zhejiang University Local Contest 2008