#P6964. [NEERC 2016] Abbreviation
[NEERC 2016] Abbreviation
Description
定义 word 为一个首字母大写、长度大于 、 其他位为小写字母的单词,如 Ab、 Abc、 Abcd 和 Abcde,但 ab、A、 AB、 ABc 和 AbC 不是。
定义一个 word 串为一个有大于 个 word 、每两个 word 中有且只有一个空格的串,如 International Business Machines。
现给你若干行,如遇到 word 串则让他变为缩写,缩写方式为:先提取首字母(大写),再加空格和 ( ,再把全称写出来,最后加上 ) ,如: International Business Machines 可缩写为 IBM (International Business Machines) 。
Input Format
若干行(不超过 行)由大小写字母、标点和空格组成的的字符串(每行不超过 个字符)。
Output Format
缩写后的若干行字符串(无法缩写的不用缩写)。
translate by:ddgtang
This is ACM North Eastern European Regional Contest,
sponsored by International Business Machines.
The. Best. Contest. Ever.
A Great Opportunity for all contestants.
This is ACM NEERC (North Eastern European Regional Contest),
sponsored by IBM (International Business Machines).
The. Best. Contest. Ever.
A GO (Great Opportunity) for all contestants.
ab Ab A Abc AB Abcd ABc Abcde AbC
ab Ab A Abc AB Abcd ABc Abcde AbC
Oh No Extra Spaces.And,Punctuation Ruin Everything
Oh No ES (Extra Spaces).And,PRE (Punctuation Ruin Everything)
京公网安备 11011102002149号