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. 每天一水SGU347

    今天本来应该要写校题解报告的,但是CF跪了,一题都没JUDGE出来,最后比赛取消了~郁闷啊! 后来闲的无事,就到处看看contest,随便点进去一个,看到一水题,几分钟写完,马上就WA了!~ 题目的信 ...

  2. .NET MVC 依赖注入 来龙去脉

    找了很久,找到一篇好文章,细读很有收获: 点击打开链接http://www.codeproject.com/Articles/560798/ASP-NET-MVC-Controller-Depende ...

  3. 《sed的流艺术之二》-linux命令五分钟系列之二十二

    本原创文章属于<Linux大棚>博客,博客地址为http://roclinux.cn.文章作者为rocrocket. 为了防止某些网站的恶性转载,特在每篇文章前加入此信息,还望读者体谅. ...

  4. Javascript数组的indexOf()、lastIndexOf()方法

    在javascript数组中提供了两个方法来对数组进行查找,这两个方法分别为indexOf(),lastIndexOf(). 这两个方法都有两个参数,第一个参数为需要查找的项,第二个参数则是查找的起始 ...

  5. canvas径向渐变详解

    创建径向渐变步骤如下: 1,创建径向渐变对象 createRadialGradient(x0,y0,r0,x1,y1,r1),其中x0,y0,r0分别为起始圆的位置坐标和半径,x1,y1,r1为终止圆 ...

  6. PHP中,JS和CSS优化工具Minify的使用方法

    为减少HTTP请求,我们往往需要合并和压缩多个JS和CSS文件,下面记录下网上关于实现这个功能的PHP源码以及开源项目Minify的使用方法 一.实现合并和压缩多个JS和CSS文件的代码请参考 1.一 ...

  7. C语言结构体中的函数指针

      这篇文章简单的叙述一下函数指针在结构体中的应用,为后面的一系列文章打下基础 本文地址:http://www.cnblogs.com/archimedes/p/function-pointer-in ...

  8. TDirectory.GetFileSystemEntries获取指定目录下的目录和文件

    使用函数: System.IOUtils.TDirectory.GetFileSystemEntries 所有重载: class function GetFileSystemEntries(const ...

  9. HTML 页面加载动画效果

    浏览器:Chrome, IE <!doctype html> <html> <head> <title>CSS transform: CSS only ...

  10. Entity Framework Code First 映射继承关系

    转载 http://www.th7.cn/Program/net/201301/122153.shtml Code First如何处理类之间的继承关系.Entity Framework Code Fi ...