Guest
Login
跳过导航链接

Abbreviation
Time Limit:1000MS  Memory Limit:32768K

Description:

As we know, we often use a short sequence of characters in place of some words with a very long name. For example, ACM is an abbreviation of “Associatin for Computing Machinery”.
Now we are using an acronymic method to get the abbreviation. An acronyms generated from a long name by capitalizing the first letter of every word in the name and concatenating them together. There is an exception: some words are ignored when generating the abbreviation. These words(case insensitive) meet the following rules:
1. The common words”and”,”for”,and “the”.
2. The words with length less than 3, such as “a”, “of”, “to”.
Your job is to get the abbreviation of a given string by using the acronymic method.

Input:

The first line of the input is a positive integer T. T is the number of test cases followed. Each test case contains a string S with its length no greater than 100, representing the sequence of words to be abbreviated. The words consist of only alphabetic letter. There is only one space between the words, and there is no leading or trailing spaces in the string.

Output:

For each test case, output the abbreviation of S.

Sample Input:

5
Association for Computer Machinery
Zhe Jiang University of Technology
Institute of Electrical and Electronics Engineers
The Lord of the Rings
Netease

Sample Output:

ACM
ZJUT
IEEE
LR
N

Source:

qn
Status  Submit


Zhe Jiang University Of Technology Online Programming Space Beta1.3
Designed & Developped By Jin Qiwei
Refactored By cb@zjut.edu.cn , QQ Group: 723311416  All Copyright Reserved 2006-
707