CF: 71A (Way Too Long Words)


Problem link: http://codeforces.com/contest/71/problem/A

Solution


// @BEGIN_OF_SOURCE_CODE

#include <cstdio>
#include <cstring>

using namespace std;

int main(int argc, const char * argv[])
{
    int testCases;

    scanf ("%d", &testCases);

    char word [100 + 10];

    while ( testCases-- ) {

        scanf ("%s", word);

        int length = (int) strlen (word);

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

    }

    return 0;
}

// @END_OF_SOURCE_CODE

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s