Codeforces Beta Round #65 (Div. 2) / 71A Way Too Long Words(字符串操作)

codeforces71A-C语言解题报告 71A题目地址 题目解答 1.输入单词 超过10个字母的单词,输出第一个字母+中间个数+最后一个字母 没有超过的,直接输出 2.循环读取输入 在for循环内部,接收用户输入的单词 知识点 1.接收用户输入 int a; scanf("%d",&a); 2.字符串数组 C语言中没有专门的字符串数组,通过字符数组的方式存放 char arr[100]; 3.计算字符串长度 #include<string.h> int str=strlen(arr); 4.C语言中没有截取字符串的方法,所以使 阅读详情

A. Way Too Long Words
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

Sometimes some words like "localization" or "internationalization" are so long that writing them many times in one text is quite tiresome.

Let's consider a word too long, if its length is strictly more than 10 characters. All too long words should be replaced with a special abbreviation.

This abbreviation is made like this: we write down the first and the last letter of a word and between them we write the number of letters between the first and the last letters. That number is in decimal system and doesn't contain any leading zeroes.

Thus, "localization" will be spelt as "l10n", and "internationalization» will be spelt as "i18n".

You are suggested to automatize the process of changing the words with abbreviations. At that all too long words should be replaced by the abbreviation and the words that are not too long should not undergo any changes.

Input

The first line contains an integer n (1 ≤ n ≤ 100). Each of the following n lines contains one word. All the words consist of lowercase Latin letters and possess the lengths of from 1 to 100 characters.

Output

Print n lines. The i-th line should contain the result of replacing of the i-th word from the input data.

Sample test(s)
input
4
word
localization
internationalization
pneumonoultramicroscopicsilicovolcanoconiosis
output
word
l10n
i18n
p43s

注意使用gets前读掉'\n'


完整代码:

/*0ms,0KB*/

#include<cstdio>
#include<cstring>

char word[101];

int main()
{
	int n, len;
	scanf("%d", &n);
	getchar();///使用gets前一定要把'\n'读掉!
	while (n--)
	{
		memset(word, 0, sizeof(word));
		gets(word);
		len = strlen(word);
		if (len > 10)
			printf("%c%d%c\n", word[0], len - 2, word[len - 1]);
		else
			printf("%s\n", word);
	}
	return 0;
}



Cesium 实战 04 - 标绘功能系列之画点(draw point) Cesium 实战 - 标绘功能之画点(draw point)。 阅读详情

相关推荐

【5G NB-IoT NTN】3GPP R17 NB-IoT NTN介绍_nbiot ntn

你的支持,我的动力;祝各位前程似锦,offer不断,步步高升!!!” />你的支持,我的动力;祝各位前程似锦,offer不断,步步高升!!!更多资料点击此处获qu!!

2401_83703866的博客 3165

A. Way Too Long Words

time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Sometimes some words like "localization" or "internationalizatio

无知的我 1958

【论文分享】【Agent】ProAgent: Building Proactive Cooperative Agents with Large Language Models

多智能体系统是由多个智能体组成的集合,这些智能体可以是软件程序、机器人、传感器或其他实体,它们各自具备一定的智能和自主性,并通过交互协作来实现单个智能体难以完成的复杂目标。

nanxun___的博客 1122

codeforces 71A. Way Too Long Words,B - Progress Bar

A. Way Too Long Words 题目链接:codeforces 71A 题意: 如果给的字符串长度大于10, 那么中间的字母用总长度减去2表示 #include<bits/stdc++.h> int main(){ int i,j,l,n; char a[105]; scanf("%d",&n); while(n--){ scanf("%...

error311的博客 387

CRC校验查表法详解

CRC校验的查表法理解算法原理基础计算查表法原理及计算查表法中的表CRC校验中数据逆序CRC校验中的其它参数 算法原理 CRC(Cyclic Redundance Check)循环冗余校验,是基于某个多项式计算出一组校验码,用于核对数据传输过程中是否被更改或传输错误 基础计算 假设需要检验的数据 g :10100111,这串二进制码可以表示为代数多项式g(x) = x^7 + x^5 + x^2 + x +1, 而作为除数的多项式 h(x) 可以自由选择或者按照国际标准选择,一般h(x)的阶数如果是m

boom的博客 1万+

iOS 取证窍门:为什么要先从 Recovery 恢复模式开始?

未记录的 DFU 代表“设备固件升级”。与专为普通用户设计的恢复模式不同,DFU 模式从来都不是为公众设计的。Apple 知识库中的任何地方都没有关于 DFU 的文档。进入 DFU 的方法主要是通过按下、按住和释放按钮的复杂操作序列,并具有精确的时间限制。在多个步骤中的任何一个步骤中,如果时间错误,都会导致重新启动设备,而不是将其切换到 DFU。另外,设备屏幕上也没有 DFU 模式的指示。如果设备成功切换到 DFU,显示屏将保持黑色。即使对于专家来说,进入 DFU 模式也可能很困难。恢复模式是最容易解释的。

2302_82041293的博客 1198

Way Too Long Words 单词太长了

Sometimes some words like “localization” or “internationalization” are so long that writing them many times in one text is quite tiresome. Let’s consider a word too long, if its length is strictly more than 10 characters. All too long words should be repla

weixin_46011385的博客 700

风力发电机缺陷检测平台

风力发电机缺陷检测平台相关内容展示

weixin_39779415的博客 1111

codeforces 71A Way Too Long Words(水题)

A. Way Too Long Words time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Sometimes some words like "localization" or "in

2736

AUTOSAR OS详细介绍及配置说明(更新版20240115)

AUTOSAR OS扩展了OSEK/VDX标准中的操作系统,所以本文结合OSEK/VDX的标准来介绍AUTOSAR OS,并借助Vector Configurator讲解AUTOSAR OS的配置。源于德语,英文意思是:“车载电子设备的开发系统和接口”,它是一个标准,用来产生嵌入式操作系统的规范,通讯协议栈,和汽车网络管理协议,也产生其他相关的规范。OSEK被设计来提供整车的各种电子控制单元的软件标准架构。

酒无忧的博客 1422

面经-2023-哲库Zeku-数字芯片设计

面经-2023-哲库Zeku-数字芯片设计

w0shishabi的博客 3907

Way Too Long Words

Way Too Long Words Sometimes some words like "localization" or "internationalization" are so long that writing them many times in one text is quite tiresome. Let's consider a word too long, if its ...

weixin_44006014的博客 543

【部署】Ubuntu 24.04.4虚拟机下部署OpenClaw

OpenClaw是一款基于AI的智能助手工具,本文详细介绍了在Ubuntu 24.04.4系统上的三种安装方法。推荐使用一键安装脚本(curl -fsSL https://openclaw.ai/install.sh | bash),自动完成Node.js检测、CLI安装和引导配置。对于开发者,提供了从源码构建的详细步骤,包括环境准备、依赖安装和构建流程。文章还包含常见问题解决方案(如sharp构建错误处理)以及后续维护建议(更新、配置检查和日志查看)。安装完成后,用户可通过终端TUI或Web UI进行初始

海兰 1万+

codeforces水题100道 第二十一题 Codeforces Beta Round #65 (Div. 2) A. Way Too Long Words (strings)...

题目链接:http://www.codeforces.com/problemset/problem/71/A题意:将长字符串改成简写格式。C++代码: #include &lt;string&gt; #include &lt;iostream&gt; using namespace std; int n; string s; int main() { cin &gt...

weixin_34403693的博客 189

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

A. Way Too Long Words c语言

#include <stdio.h> int main() { int n; scanf("%d", &n); getchar(); for (int i = 0; i < n; i++) { char str[105]={0}; char c; int local = 0; while ((c = getchar()) != EOF && c != '...

Arcane_mage77的博客 344

迈瑞BS系列全自动生化分析仪LIS协议接口手册(内含HL7和ASTM)

迈瑞BS系列全自动生化分析仪LIS协议接口手册,内含HL7和ASTM)

codeforce-71A :way too long words

Sometimes some words like “localization” or “internationalization” are so long that writing them many times in one text is quite tiresome. Let’s consider a word too long, if its length is strictly more than 10 characters. All too long words should be repla

DT1794237085的博客 853

C语言——codeforces 71A题解

A. Way Too Long Words time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Sometimes some words like "localization" or "internationaliz...

隔壁小贺 726

Codeforces 71A-Way Too Long Words

思路:给你一个字符串,如果长度小于等于10,就原样输出,否则输出第一个字符+”原字符串长度-2“+最后一个字符。有用的英文单词:abbreviation 缩写 decimal 十进制的 undergo 经历。

ywzdcj的博客 296

CF#71A Way Too Long Words

A. Way Too Long Words time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Sometimes some words like "localizati

Momo 1084

A. Way Too Long Words(无思维纯模拟)

使用.size()获取长度,最好储存在变量里方便使用。无思维简单模拟题,所有步骤都可以简单地实现。长度超过十的字符串只输出首+长度-2+尾。不超过十的字符串直接输出。

m0_72496300的博客 166

71A. Way Too Long Words

71A. Way Too Long Words题目翻译题目输入输出分析代码 题目 翻译 题目     有时一些单词如“localization”或者“internationalization”实在是太长了以至于要在一个文本里多次写下他们实在太累了。     这样我们认为如果一个单词其长度大于10个字符,那么它就太长了。所有太长的单词应该用特殊的缩写来代替。     这个缩写是这样的:我们

Mr_L_K的博客 645

【CodeForces】A. Way Too Long Words

Problem here: http: //codeforces.com/problemset/problem/71/AProblemSometimes some words like “localization” or “internationalization” are so long that writing them many times in one text is quite tires

Blog 779

BUAA-SCSE Training day1

小学期-计组实验 的确像学长说的认真做会有收获 今天老师检查的时候发现自己好多地方没有掌握 明天去好好看一看 大一开了算法提高班 好想去参加。。。 自己的基础实在是太差 有没有说什么都放下专心的搞算法 一直都是处于这样不尴不尬的境地 感觉昂神这个算法提高班的题目好像杭电的acm steps 刷起来蛮有感觉的。。 虽然好多题目不会。。 刚刚回宿舍水了一发贪心

VeryBigMan 2060
上一篇: Codeforces VK Cup 2012 Qualification Round 1 / 158A Next Round(模拟)
下一篇: Codeforces Beta Round #89 (Div. 2) / 118A String Task(字符串操作)
synapse7
博客等级 码龄14年 432粉丝 701原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值