Problem Description

定义:一个词组中每个单词的首字母的大写组合称为该词组的缩写。

比如,C语言里常用的EOF就是end of file的缩写。

Input

输入的第一行是一个整数T,表示一共有T组测试数据;

接下来有T行,每组测试数据占一行,每行有一个词组,每个词组由一个或多个单词组成;每组的单词个数不超过10个,每个单词有一个或多个大写或小写字母组成;

单词长度不超过10,由一个或多个空格分隔这些单词。

Output

请为每组测试数据输出规定的缩写,每组输出占一行。

Sample Input

1

end of file

Sample Output

EOF

大水题~ JAVA大发法好啊。

import java.util.Scanner;

/**
* @author 陈浩翔
* 2016-6-5
*/
public class Main{ public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t=sc.nextInt();
sc.nextLine();
while(t-->0){
String str=sc.nextLine();
String[] s=str.split(" ");
String result="";
for(int i=0;i<s.length;i++){
if(s[i].length()>=1)
result+=s[i].charAt(0);
}
System.out.println(result.toUpperCase());
}
}
}

HDOJ/HDU 2564 词组缩写(单词缩写)的更多相关文章

  1. hdu 2564 词组缩写

    Problem Description 定义:一个词组中每个单词的首字母的大写组合称为该词组的缩写. 比如,C语言里常用的EOF就是end of file的缩写. Input 输入的第一行是一个整数T ...

  2. [LeetCode] Minimum Unique Word Abbreviation 最短的独一无二的单词缩写

    A string such as "word" contains the following abbreviations: ["word", "1or ...

  3. [LeetCode] Valid Word Abbreviation 验证单词缩写

    Given a non-empty string s and an abbreviation abbr, return whether the string matches with the give ...

  4. [LeetCode] Unique Word Abbreviation 独特的单词缩写

    An abbreviation of a word follows the form <first letter><number><last letter>. Be ...

  5. 单词缩写(abbr.cpp)每日一题

    题目描述:YXY 发现好多计算机中的单词都是缩写,如 GDB,它是全称 Gnu DeBug 的缩写.但是,有时缩写对应的全称并不固定,如缩写 LINUX,可以理解为:(1)LINus's UniX ( ...

  6. [LeetCode] Word Abbreviation 单词缩写

    Given an array of n distinct non-empty strings, you need to generate minimal possible abbreviations ...

  7. [Swift]LeetCode288. 唯一单词缩写 $ Unique Word Abbreviation

    An abbreviation of a word follows the form <first letter><number><last letter>. Be ...

  8. [LeetCode] 527. Word Abbreviation 单词缩写

    Given an array of n distinct non-empty strings, you need to generate minimal possible abbreviations ...

  9. [LeetCode] 288.Unique Word Abbreviation 独特的单词缩写

    An abbreviation of a word follows the form <first letter><number><last letter>. Be ...

随机推荐

  1. HDU 1619 Unidirectional TSP(单向TSP + 路径打印)

    Unidirectional TSP Problem Description Problems that require minimum paths through some domain appea ...

  2. 动态规划&矩阵连乘

    动态规划&矩阵连乘 动态规划的概念 •     与分治方法类似       分-治-合 • 与分治方法不同       子问题之间并非相互独立 •     基本思想        用一个表记录 ...

  3. (转)UIColor,CGColor,CIColor三者的区别和联系

    最近看了看CoreGraphics的东西,看到关于CGColor的东西,于是就想着顺便看看UIColor,CIColor,弄清楚它们之间的区别和联系.下面我们分别看看它们三个的概念: 一.UIColo ...

  4. Scala - error: not found: value SortedMap

    先 IMPORT!!!! scala> import scala.collection._import scala.collection._ scala>  SortedMap(" ...

  5. 安装hadoop多节点 各种整理

    ubuntu烧制usb启动盘链接: 点击打开链接https://help.ubuntu.com/community/Installation/FromUSBStick ubuntu磁盘分区: 点击打开 ...

  6. VMware中Ubuntu忘记密码的解决办法

    在VMware中安装了Ubuntu 11.04,经过了一个长假,再次登录的时候居然进不去了,一开始不知道怎样在虚拟机中进入到Grub启动界面,网上搜索了一番,按照以下步骤重新为用户设定了新密码. 重启 ...

  7. Linux网络应用编程之交换机概述

    Packet Tracer入门 一,交换机概况 交换机工作在OSI(开放系统互联参考模型)数据链路层,接入交换机的任意两个网络节点(网络设备)都是独享带宽的. 二,交换机原理 交换机拥有一条很高带宽的 ...

  8. node开子线程模块--tagg2

    tagg2包同样具有tagg包的多线程功能,采用新的node-gyp命令进行编译,同时它跨平台支持,mac,linux,windows下都可以使用,对开发人员的api也更加友好.安装方法很简单,直接n ...

  9. linux压缩与解压缩 tar命令

    #压缩tar -czvf ***.tar.gz  filetar -cjvf ***.tar.bz2 file#解压缩tar -xzvf ***.tar.gz filetar -xjvf ***.ta ...

  10. Linux-Tcp-IP

    /* tcpcli.c */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include ...