Codeforces 71A Way Too Long Words

去年面谷歌的时候还被问过这道题。最后还是悲剧了,好伤心:sob:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _71A
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            while (n-- != 0)
            {
                string word = Console.ReadLine();
                if (word.Length <= 10)
                {
                    Console.WriteLine(word);
                }
                else
                {
                    string abbr = word[0].ToString() + (word.Length - 2).ToString() + word[word.Length - 1].ToString();
                    Console.WriteLine(abbr);
                }
            }
        }
    }
}

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注