原题:
ACM ICPC 2016–2017, Northeastern European Regional Contest.
St. Petersburg – Barnaul – Tbilisi – Almaty, December 4, 2016
Problem A. Abbreviation
Input file: abbreviation.in
Output file: abbreviation.out
An abbreviation (from Latin brevis, meaning short) is a shortened form of a word or phrase. In this
problem you must write an automated tool that replaces a sequence of capitalized words with the corresponding abbreviation that consists of the first upper case letters only, followed by a full definition in
parenthesis. See sample input and output.
Let us make some formal definitions. A word in a text is a maximally long sequence of lower and upper
case English letters. A capitalized word is a word that consists of an upper case letter followed by one
or more lower case letters. For example, “Ab”, “Abc”, “Abcd”, and “Abcde“ are all capitalized words,
while “ab”, “A”, “AB“, “ABc“ and “AbC“ are not.
An