Problem:
Score : 200 points

Problem Statement

The word internationalization is sometimes abbreviated to i18n.
This comes from the fact that there are 18 letters between the first i and the last n.

You are given a string s of length at least 3 consisting of lowercase English letters.
Abbreviate s in the same way.

Constraints

3 ≤ |s| ≤ 100 (|s| denotes the length of s.)

s consists of lowercase English letters.

Input

Input is given from Standard Input in the following format:

s

Output

Print the abbreviation of s.

Sample Input 1

internationalization

Sample Output 1

i18n

Sample Input 2

smiles

Sample Output 2

s4s

Sample Input 3

xyz

Sample Output 3

x1z

Solution in C (GCC 5.4.1) (judge verdict: Wrong Answer)

#include <stdio.h>

char int2char(int a) {
    char b = '0' + a;
    return b;
}

int cal_dig(int n) {
    int count=0;
    if(n/100) {
        count = 3;
        return count;
    } else {
        if(n/10) {
            count = 2;
            return count;
        } else {
            count = 1;
            return count;
        }
    }
}

int main() {
    char s[102];
    int i, num;
    for(i=0; i<34; i++) {
        s[i] = ' ';
        s[i+34] = ' ';
        s[i+68] = ' ';
    }
    scanf("%s", s);
    // printf("%s", s);

    char ans[6]={};
    int count=1, j=1, k;
    ans[0] = s[0];

    for(i=0; i<101; i++) {
        if(s[i]==' ') {
            i -= 1;
            // printf("%d\n", i);
            // printf("%d\n", count);
            num = i;
            i -= 2;
            for(k=0; k<cal_dig(num-2)-1; k++) {
                count *= 10;
            }
            for(k=0; k<cal_dig(num-2); k++) {
                ans[k+1] = int2char(i/count);
                i -= (i/count)*count;
                count /= 10;
            }
            ans[k+1] = s[num-1];
            break;
        }
    }

    printf("%s\n", ans);

    return 0;

}