Tuesday, 1 March 2016

Codeforces Problem : 71A - Way Too Long Words


Problem Link :  http://codeforces.com/problemset/problem/71/A

Solve :

#include<stdio.h>
#include<string.h>

int main()
{
    char input[100];
    int length,test,Loop;

    scanf("%d",&test);

    for(Loop=1; Loop<=test; Loop++)
    {
        scanf("%s",input);

        length=strlen(input);

        if(length<=10)
            printf("%s\n",input);
        else
        {
            printf("%c%d%c\n",input[0],length-2,input[length-1]);
        }
    }

    return 0;
}

No comments:

Post a Comment