码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2016-07-20 19:40:50      阅读:110      评论:0      收藏:0      [点我收藏+]

标签:

题目链接:http://www.codeforces.com/problemset/problem/71/A
题意:将长字符串改成简写格式。
C++代码:

技术分享
#include <string>
#include <iostream>
using namespace std;
int n;
string s;
int main()
{
    cin >> n;
    while (n --)
    {
        cin >> s;
        if (s.length() > 10)
            cout << s[0] << s.length()-2 << s[s.length()-1] << endl;
        else
            cout << s << endl;
    }
    return 0;
}
C++

 

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

标签:

原文地址:http://www.cnblogs.com/moonlightpoet/p/5689393.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!