codeforces71A
Way Too Long Words
XUPT_ACM的杨队是一个强迫症晚期的大神,他特别反感长单词,就像 "localization" 和"internationalization" 。
于是睿智的杨队想出了一个方法来节约写单词的时间, 如果单词的长度严格大于10个字符,那么他可以用以下方法表示:
写下这个单词的第一个字母与最后一个字母,在它们之间写下除去第一个字母和最后一个字母后该单词包含的字母个数,这个数字是不包含前导零的十进制数字。
举个栗子, "localization" 可以表示为"l10n", "internationalization"可以被表示为"i18n".
你的任务是通过编写代码实现这样一个转化的过程,太长的单词通过上述方法表示,其他的单词保持不变
Input
第一行包含一个整数n (1 ≤ n ≤ 100). 接下来n行每行包含一个单词. 所有的单词由小写字母组成,单词的长度为1 到100个字符.
Output
输出 n 行. 第 i 行包括第 i 个单词的转化结果.
Examples
4
word
localization
internationalization
pneumonoultramicroscopicsilicovolcanoconiosis
word
l10n
i18n
p43s sol:直接按题意模拟就可以了
#include <bits/stdc++.h>
using namespace std;
typedef int ll;
inline ll read()
{
ll s=;
bool f=;
char ch=' ';
while(!isdigit(ch))
{
f|=(ch=='-'); ch=getchar();
}
while(isdigit(ch))
{
s=(s<<)+(s<<)+(ch^); ch=getchar();
}
return (f)?(-s):(s);
}
#define R(x) x=read()
inline void write(ll x)
{
if(x<)
{
putchar('-'); x=-x;
}
if(x<)
{
putchar(x+''); return;
}
write(x/);
putchar((x%)+'');
return;
}
#define W(x) write(x),putchar(' ')
#define Wl(x) write(x),putchar('\n')
const int N=;
char S[N];
int main()
{
int T;
R(T);
while(T--)
{
scanf("%s",S+);
int Len=strlen(S+);
if(Len<=) printf("%s\n",S+);
else
{
putchar(S[]);
write(Len-);
putchar(S[Len]);
putchar('\n');
}
}
return ;
}
codeforces71A的更多相关文章
- CodeForces.71A Way Too Long Words (水模拟)
CodeForces71A. Way Too Long Words (水模拟) 题意分析 题怎么说你怎么做 没有坑点 代码总览 #include <iostream> #include & ...
随机推荐
- Arduino入门笔记(4):用蜂鸣器演奏音乐并配有LED闪烁
转载请注明:@小五义 http://www.cnblogs.com/xiaowuyi 欢迎加入讨论群 64770604 一.本次实验所需器材 1.Arduino板 https://item.taoba ...
- php操作文件类的函数
<?php /** // 一行一行读取一个文件 (文件内容很大的时候,适用.file_get_contents此场景就不太好) $re = fopen("index.php" ...
- jquery ajax error函数和及其参数详细说明(转载)
使用jquery的ajax方法向服务器发送请求的时候,常常需要使用到error函数进行错误信息的处理,本文详细的说明了ajax中error函数和函数中各个参数的用法.一般error函数返回的参数有三个 ...
- 1.6《想成为黑客,不知道这些命令行可不行》(Learn Enough Command Line to Be Dangerous)——小结
本章节学过的重要命令整理,见下表Table 2. 命令 描述 例子 echo <string> 向屏幕输出字符串 $ echo hello man <command> 显示命令 ...
- Kubernetes学习之路(二十二)之Pod资源调度
目录 Pod资源调度 1.常用的预选策略 2.优选函数 3.节点亲和调度 3.1.节点硬亲和性 3.2.节点软亲和性 4.Pod资源亲和调度 4.1.Pod硬亲和度 4.2.Pod软亲和度 4.3.P ...
- Android与Libgdx入门实例
本文讲解如何实现Android与Libgdx各自的Hello World过程. 1. Android版Hello World 点击Eclipse快捷方式,选择New Android Applicati ...
- 策略模式与SPI机制,到底有什么不同?
这里说的策略模式是一种设计模式,经常用于有多种分支情况的程序设计中.例如我们去掉水果皮,一般来说对于不同的水果,会有不同的拨皮方式.此时用程序语言来表示是这样的: if(type == apple){ ...
- jstree API
https://www.jstree.com/ drag & drop support(拖放) keyboard navigation(键盘导航) inline edit, create ...
- Css_*^$
#search_condition [class*=search_submit] 表示class name里面的值包含search_submit $("#search_condition [ ...
- centos 7 tomcat 开机自启
第一章 1.将tomcat加入开启自己,以减少手动启动的麻烦 环境配置需要提前配置好.(我这里已经是不做操作了) 192.168.1.195 jdk1.8 + tomcat 8 第二章 2.编写to ...