21621_Abbreviation

2022-5-16 18:19| 发布者: Hocassian| 查看: 26| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-4-89505697036400-Problem List-采集的数据-后羿采集器.html

Pro.ID

21621

Title

Abbreviation

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=21621

AC

2

Submit

5

Ratio

40.00%

时间&空间限制

  • Time Limit: 2000/1000 MS (Java/Others)     Memory Limit: 65536/65536 K (Java/Others)
  • 描述

    As we know, we often use a short sequence of characters in place of some words with a long name. For example, ACM is an abbreviation of "Association for Computing Machinery".

    Now we are using an acronymic method to get the abbreviation. An acronym is 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.

    输入

    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.

    输出

    Description

    As we know, we often use a short sequence of characters in place of some words with a long name. For example, ACM is an abbreviation of "Association for Computing Machinery".

    Now we are using an acronymic method to get the abbreviation. An acronym is 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
    Institute of Electrical and Electronics Engineers
    SUN YAT SEN UNIVERSITY
    The Lord of the Rings
    netease

    Sample Output

    ACM
    IEEE
    SYSU
    LR
    N

    Source

    样例输入

    5
    Association for Computer Machinery
    Institute of Electrical and Electronics Engineers
    SUN YAT SEN UNIVERSITY
    The Lord of the Rings
    netease

    样例输出

    ACM
    IEEE
    SYSU
    LR
    N

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部