process.stdin.on('data', chunk => {
  let words = chunk.toString().split('\r\n').slice(1, -1)
  console.log(words.map(w => abbreviate(w)).join('\n'))
})

function abbreviate (str) {
  if (str.length <= 10) return str
  let strArray = str.split('')
  let first = strArray.shift()
  let last = strArray.pop()
  return first + strArray.length + last
}

var readline = require('readline');
var lines  = readline.createInterface({input:process.stdin,output:process.stdout});
var numlt = 0;
var er = 0;
var values = [];

lines.write();
lines.on('line',line=>
{
    values.push(line);
    er++;
    if(er > parseInt(values[0]))
    {
        for(let i = 0; i < parseInt(values[0]) + 1; i++)
        {
            if(parseInt(i) !== 0)
            {
                var start =values[i];
                var end = values[i];
                numlt++;
                if(values[i].length > 10)
                {
                    start = start.slice(0,1);
                    end = end.slice(end.length -1,end.length);
                    values[i] = values[i].slice(1,values[i].length - 1);
                    values[i] = values[i].length;
                    values[i] = start + values[i] + end;
                }
            }
        }
    }
    if(numlt >= values[0])
    {
        console.log(values.slice(1).join('\n'));
        lines.close();
    }
});

var n=readline();
var integer=parseInt(n);
var i,text = [],newtxt = [],len;

for(i=0; i<integer; ++i){
    text[i]=readline();
    len=text[i].length;
    if(len>10){
    newtxt[i]=text[i].charAt(0)+(len-2)+text[i].charAt(len-1);

    }
    else{
        newtxt[i] = text[i];
    }
}
var output = "";
for(i=0; i<integer; ++i) {
    output = output + newtxt[i] + "\n";
}
print(output);

var n=readline();
var integer=parseInt(n);
var i,text,newtxt,len;
for(i=1; i<=integer; ++i){
    text=readline();
    len=text.length;
    if(len>10){
    newtxt=text.charAt(0)+(len-2)+text.charAt(len-1);
    print(newtxt)+"\n";
    }
    else{
        print(text)+"\n";
    }
}

var n = parseInt(readline())
while (n--) {
    var w = readline();
    if (w.length <= 10) {
        write(w + '\n');
    }else if (w.length > 10) {
        write(w[0] + (w.length - 2) + w[w.length - 1] + '\n');
    }

}

(function main() {
    var time = readline();

    var arr = new Array();

    for (i = 0; i < time; i++) {
        arr[i] = readline();
    }

    for (i = 0; i < time; i++) {
        var word = arr[i];
        var result = "";
        if (word.length > 10) {
            result += word.charAt(0);
            result += word.length - 2;
            result += word.charAt(word.length - 1);
            print(result);
        } else {
            print(word);
        }
    }
})();

 len=readline();
for(i=0;i<len;i++)
{
    x=readline();
if(x.length>10)
{
    print(x[0]+(x.length-2)+x[x.length-1])
}
else
{
    print(x)
}
}

process.stdin.on('data', data => {
    var line = data.toString().trim().split('\n');

    for(var i = 1; i <= line[0]; i++) {
        var word = line[i].trim();

        if(word.length <= 10)
            process.stdout.write(word);
        else
            process.stdout.write(word[0] + (word.length - 2) + word[word.length - 1]);

        if(i != line[0])
            process.stdout.write('\n');
    }
})

const readline = require('readline');

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

let lineCounter = 1;
let noOfWords;
let ans = [];
rl.on('line', (input) => {
    if (lineCounter === 1) {
        noOfWords = parseInt(input);
    } else if (lineCounter <= noOfWords + 1) {
        if (input.length > 10) {
            ans.push(input[0] + (input.length - 2) + input[input.length - 1])
        } else {
            ans.push(input);
        }
        if (lineCounter === noOfWords + 1) {
            rl.close();
            ans.forEach((word) => {
                console.log(word);
            })
        }

    }
    lineCounter++;
});

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

function readline() {
    return inputString[currentLine++];
}

function main() {
     let t = readline()
    t = parseInt(t)
    let s = '', res = ''
    for (let i = 0; i < t; i++) {
        s = readline().split("")
        if (s.length > 10) {
            res = s.length - 2
            res = s[0] + res + s[s.length - 1]
            console.log(res)
        } else {
            s = s.join("")
            console.log(s)
        }
    }
}

'use strict';
const n = parseInt(readline());

for (var i = 0; i < n; i++) {
    const word = readline();
    if (word.length > 10) {
        write(word[0] + (word.length - 2) + word[word.length - 1]);
    } else {
        write(word);
    }
    write('\n');
}

var read = require('readline').createInterface({
    input: process.stdin,
    output: process.stdout
});
var obj;
var inLine = [];
read.on('line', function (input) { inLine.push(input); });
read.on('close', function () {
    obj = init(inLine);
    myerr("-----start-----");
    var start = new Date();
    Main();
    var end = new Date() - start;
    myerr("----- end -----");
    myerr("Time: " + (end) + "ms");
    myerr("Memory: " + Math.round(process.memoryUsage().heapTotal / 1024) + "KB");
});
function nextInt() { return myconv(next(), 1); }
function nextStrArray() { return myconv(next(), 2); }
function nextIntArray() { return myconv(next(), 4); }
function nextCharArray() { return myconv(next(), 6); }
function next() { return obj.next(); }
function hasNext() { return obj.hasNext(); }
function init(input) {
    var returnObj = {
        list: input, index: 0, max: input.length,
        hasNext: function () { return (this.index < this.max); },
        next: function () { if (!this.hasNext()) { throw "ArrayIndexOutOfBoundsException"; } else { var returnInput = this.list[this.index]; this.index++; return returnInput; } }
    };
    return returnObj;
}
function myout(s) { console.log(s); }
function myerr(s) { console.error("debug:" + require("util").inspect(s, false, null)); }
function myconv(i, no) { try { switch (no) { case 1: return parseInt(i); case 2: return i.split(" "); case 4: return i.split(" ").map(Number); case 6: return i.split(""); case 7: return i.split("").map(Number); case 8: return i.join(" "); case 9: return i.join("\n"); case 0: return i.join(""); default: return i; } } catch (e) { return i; } }

function Main() {
    var out = [];

    var n = nextInt();

    for (i = 0; i < n; i++) {
        var word = next();
        var l = word.length;

        if (l > 10) {
            abb_n = l - 2;
            out[i] = word.charAt(0) + (l - 2).toString() + word.charAt(l - 1);
        } else {
            out[i] = word;
        }
    }
    myout(myconv(out, 9));
} // Use Terminal to debug, not Debug Console!

const readLine = require("readline").createInterface({
  input: process.stdin,
  output: process.stdout,
});

const input = [];

function splitAndParseInt(line) {
  return line.split(" ").map((x) => parseInt(x));
}

readLine.on("line", (line) => input.push(line));
readLine.on("close", () => {

  const strlength = parseInt(input[0]);
  for(let i = 1; i <= strlength; i++){
    let string = input[i];
    if(string.length > 10){
      console.log(string[0] + String(string.length - 2) + string[string.length - 1]);
    }
    else{
      console.log(string);
    }
  }
});

// Sample code to perform I/O:

process.stdin.resume();
process.stdin.setEncoding("utf-8");
var stdin_input = "";

process.stdin.on("data", function (input) {
    stdin_input += input;                               // Reading input from STDIN
});

process.stdin.on("end", function () {
    main(stdin_input);
});

function main(input) {
    let output = nameLookUp(input);
    process.stdout.write(output);       // Writing output to STDOUT
}

// Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail

// Write your code here
function nameLookUp(arr) {
    let nWords = arr.split('\n');
    let texts = '';
    for (let str of nWords) {
        if (isNaN(str)) {
            let strArr = str.trim().split('');
            if (strArr.length > 10) {
                let strLength = strArr.length;
                texts += strArr[0] + (strLength - 2) + strArr[strArr.length - 1] + '\r\n';
            } else {
                texts += str + '\r\n';
            }
        }
    }

    return texts;

}

const stdin = process.stdin;
stdin.setEncoding( 'utf8' );
stdin.on( 'data', function( rawInput ){
    const inputLines = rawInput.split(/\s+/);
    const n = parseInt(inputLines[0]);
    solveNprint(inputLines.slice(1, 1+n), n);
});

function solveNprint(strings, numOfStrings) {
    for (let strIdx = 0; strIdx < numOfStrings; strIdx++) {
        const currentString = strings[strIdx];
        const characters = currentString.split('');
        const numOfCharacters = characters.length;
        if (numOfCharacters > 10) {
            console.log(`${characters[0]}${numOfCharacters-2}${characters[numOfCharacters-1]}`);
        } else {
            console.log(currentString);
        }
    }
}

const readline = require('readline');

const rl = readline.createInterface({
	input: process.stdin,
	output: process.stdout,
	terminal: false
});
let n;
const s = [];
const sol = () => {
	s.forEach(i => { console.log(i.length > 10 ? i[0] + (i.length - 2) + i[i.length - 1] : i); });
};

rl.on('line', function(line) {
	if (!n) {
		n = parseInt(line);
	} else if (s.length < n) {
		s.push(line);
		if (s.length === n) {
			sol();
			rl.close();
		}
	}
});

const ascending = (x, y) => x - y;
const descending = (x, y) => y - x;
const log = console.log;

function solve(input) {
    input = input.toString().split(/\r?\n/);

    let res = [];

    let N = +input[0];

    for (let i = 0, inputRow = 1; i < N; i++) {
        let s = input[inputRow++];

        let ans = s;
        if (s.length > 10) {
            ans = s[0] + (s.length-2) + s[s.length - 1];
        }

        res.push(ans);
    }
    return res.join('\n');
}

async function main() {

    try {

        let input = await new Promise(resolve => {

            let _input = '';
            process.stdin.resume();
            process.stdin.setEncoding('utf-8');
            process.stdin.on('data', (buf) => {
                _input += buf;
            });
            process.stdin.on('end', () => {
                resolve(_input);
            });

        });
        let output = solve(input);

        console.log(output);

    } catch (err) {
        console.error(err);
    }
}

main();

let inputString = "";
let currentLine = 0;
process.stdin.on("data", (data) => {
  inputString += data;
});
process.stdin.on("end", function () {
  inputString = inputString
    .trim()
    .split("\n")
    .map((str) => str.trim());
  main();
});
function readLine() {
  return inputString[currentLine++];
}
function main() {
  var T = readLine();
  while (T--) {
    var str = readLine();
    var strArr = str.split("");
    var strFLetter = strArr[0];
    var strLLetter = strArr[strArr.length - 1];
    if (strArr.length > 10) {
      console.log(`${strFLetter}${strArr.length - 2}${strLLetter}`);
    } else {
      console.log(str);
    }
  }
}

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').join(' ').split(' ').map(string => {
        return string.trim();
    });

    main();
});

function read() {
    return inputString[currentLine++];
}

function main() {
    let t = Number(read())
    while (t) {
        t = t - 1
        const s = read()
        if (s.length <= 10) {
            process.stdout.write(s + '\n')
            continue
        }
        process.stdout.write(s[0] + (s.length - 2) + s[s.length - 1] + '\n')

    }
}

const readline = require('readline')
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});

var input = [];
rl.on('line', (line) => {
  input.push(line);
});

rl.on('close', () => {
  run(input);
});

function run(input) {
  var num = parseInt(input[0]);
  for (var i = 0; i < num; ++i) {
    const word = input[i+1];
    if (word.length <= 10) {
      console.log(word);
    } else {
      var count = word.length - 2;
      console.log(word[0] + count + word[word.length - 1]);
    }
  }
}

function isToolong(word) {
    return word.length > 10;
}

function abbr(word) {
    var start = word[0];
    var end = word[word.length - 1];
    var middle = word.slice(1, word.length - 1);
    return start + middle.length + end;
}

// write("How many words: ");
var wordAmount = readline();
var word;

for (var i = 0; i < wordAmount; i++) {
    // write("Enter word: ");
    word = readline();
    if (isToolong(word)) {
        print(abbr(word));
    } else {
        print(word);
    }
}

const readline = require('readline')

const rl = readline.createInterface({
	    input: process.stdin,
	    output: process.stdout,
	terminal : false
});

/*const write = fs.createWriteStream('output.txt', {
	flags : 'a'
})

const data = fs.readFileSync('input.txt', 'UTF-8');

const lines = data.split(/\r?\n/)

const n = lines[0]

for(var i = 1; i <= n; i++){
	const word = lines[i]
	if(word.length < 10){
		write.write(word)
		write.write("\n")
	}
	else{
		const abbrev = `${word.charAt(0)}${word.length-2}${word.charAt(word.length)}`
		write.write(abbrev)
		write.write("\n")
	}

}
*/

rl.on("line", main)
let i = 0
let n;
function main(input){
	if(i == 0){
		n = input
		i++
		return
	}
	if(input.length <= 10){
		console.log(input)
	}
	else{

		let abbrev =  `${input.charAt(0)}${input.length-2}${input.charAt(input.length-1)}`
		console.log(abbrev)
	}
	i++

}

const readLine = require('readline').createInterface({
    input: process.stdin,
    output: process.stdout,
});

const input = [];
readLine.on('line', line => input.push(line));

const longWords = () => {
    //  const q = +input[0];

    const n = +input.shift();
    for (let x of input) {
       if (x.length > 10 ) {
           let newword = '';
           newword += x[0];
           newword += x.length-2;
           newword += x[x.length-1]
           console.log(newword);
       }
       else {
           console.log(x)
       }
    }

};

readLine.on('close', longWords);

function main(){
  var n = +readline();
  var words;

  for (i = 0; i < n; i++) {
    words = readline();
    if (words.length > 10) {
      words = words[0]+(words.length-2)+words[words.length-1]
    }
    print(words);
  }
}

main();

x=+readline()
while(x--) {
    s=readline();
    if(s.length>10)
        s=s[0]+(s.length-2)+s[s.length-1]
    print(s)
}

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStd => {
	inputString += inputStd;
});
process.stdin.on('end', _ => {
	inputString = inputString.trim().split('\n').map( str => {
		return str.trim();
	});
	main();
});
function readLine() {
	return inputString[currentLine++];
}
function main() {
	const n = +(readLine());
	for(let i = 0; i < n; i++) {
		const str = readLine();
		if(str.length <= 10) console.log(str);
		if(str.length > 10) console.log(`${str[0]}${str.length - 2}${str[str.length - 1]} `);
	}
}

const { isString } = require('util');

const rl = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false,
});

rl.on('line', (line) => {
  const l = line.length;

  if (isNaN(Number(line)))
    console.log(l > 10 ? `${line[0]}${l - 2}${line[l - 1]}` : line);
});

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.replace(/\s*$/, '')
        .split('\n')
        .map(str => str.replace(/\s*$/, ''));

    main();
});

function readLine() {
    return inputString[currentLine++];
}

function main() {
    var n = parseInt(readLine());
    var arr = [];
    for (var i = 0; i < n; i++) {
        arr.push(readLine());
    }
    let ans = [];
    arr.forEach(element => {
        if (element.length > 10) {
            console.log(element[0] + element.slice(1, element.length - 1).length + element[element.length - 1]);
        } else console.log(element);
    });
}

function wayTooLongWords(word) {
  if (word.length <= 10) return console.log(word);
  let middle = word.length - 2;
  return console.log(word[0] + middle + word[word.length - 1]);
}

// read file
const readline = require("readline");
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});

// read each line
let bool = false;
rl.on("line", (lineInput) => {
  if (bool) wayTooLongWords(lineInput);
  bool = true;
});

// when all file readed
rl.on("close", () => {});

'use strict';

let inputFromTerminal = ''
process.stdin.on('data', c => inputFromTerminal += c)
process.stdin.on('end', () => {
    const { EOL } = require('os')
    const lines = inputFromTerminal.split(EOL)

    let t = Number(lines[0])

    for(let i=1; i<t+1; i++){

       if(lines[i].length > 10){
           let word = longWord(lines[i])
           console.log(word)
       } else {
           console.log(lines[i])
       }
    }

})

function longWord(word) {

   let lengthThisWord = word.length;
   let firstLetter = word.charAt(0)
    let lastLetter = word.charAt(lengthThisWord - 1)
    let number = lengthThisWord -2
    return `${firstLetter}${number}${lastLetter}`

}

const readline = require("readline");
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});
let words = null;
let counter = 0;
rl.on('line', line=>{
  if(words == null){
    words = new Array(parseInt(line))
  }
  else{
    words[counter] = line;
    processWords(words[counter]);
    counter++;
  }

  if(counter >= words.lenght){
    rl.close();
    processWords();
  }
});

let processWords = (word) => {
    if(word.length > 10){
      let s = word.charAt(0);
      s+= word.length-2;
      s+=word.charAt(word.length - 1);
      console.log(s);
    }
    else{
      console.log(word);
    }
}

var n = parseInt(readline());
for (var i=0; i<n;i++){
    var palabra = readline();
    var talla = palabra.length;
    if(talla <=10){
        print (palabra);
    }
   else if(talla > 10){
        letrap = palabra[0];
        letrau = palabra[talla-1];
        letram = talla-2;
        print (letrap+letram+letrau);
    }
    }

// /************* KEEP BELOW CODE AS IT IS *********************/
let i = ''
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
    const {EOL} = require('os')
    const lines = i.split(EOL) /*your input text, split by lines*/
    // console.log(lines);

    // remove '4' string from lines
     let strings = [];
     lines.map((line) => {
       if(isNaN(parseInt((line)))){
        //  console.log(line);
         strings.push(line);
       }
     });
    //  console.log(strings);

    strings.forEach((line) => {
        // console.log(line);
        if (line.length <= 10)
        {
            // console.log("lower than 10 and string");
            console.log(line);
        }
        else
        {
            //   console.log("higher 10 and string");
            // l10n
            let first = line.charAt(0);
            // console.log(first);
            // console.log(line.length);
            let last = line.charAt(line.length - 1);
            // console.log(last);
            let inBetween = line.length -2
            console.log(first + inBetween + last);
        }

    })
})

 function tooLongWords(n)
{
    if (n.length > 10)
    {
            return n[0] + (n.length - 2) + n[n.length - 1];
    }
    else return n;
}
{
    var input = parseInt(readline(''));
    for (var i = 1; i <= input; i++ )
    {
        var inputMain = readline();
        print(tooLongWords(inputMain));
    }
}

function main() {
    // write code here:
    var n = Number(stdin[0]);
    var arr=[];
    for(var i=1;i<=n;i++){
        var len=stdin[i].length;
        if(len>10){
            arr.push(stdin[i].replace(stdin[i].slice(1,len-1),len-2));
        }else{
            arr.push(stdin[i]);
        }
    }
    console.log(arr.join('\n'));
}

const readline = require('readline');
const rl = readline.createInterface({input: process.stdin});
var stdin = [];
rl.on('line', function (line) {
    stdin.push(line);
});
rl.on('close', main);

let i = ''
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
    const {EOL} = require('os')
    const lines = i.split(EOL) /*your input text, split by lines*/

function elimina(x) {

for(var i = 1; i<x.length; i++) {
    var str = x[i];

if(str.length <= 10) {
    console.log(str);
}
else {
  var arr = str.split("");
  var lungime = arr.length;
  var primaParte = arr[0];
  var ultimaParte = arr[lungime - 1];
  var mijloc = lungime - 2;
  var rand = primaParte + mijloc + ultimaParte;
  console.log(rand);
}
}

}
elimina(lines);
})

var t = readline();

while(t--){

    var x=readline();
    if(x.length>10){
        x=x.split('');
        print(x[0] + (x.length-2) + x[x.length-1]);
    }else{
        print(x);
    }
}

"use strict"
let n = readline();
n = +n;
while (n > 0) {
   n--;
   const s = readline();
   const l = s.length;
   if (l > 10)
      print(s[0] + (l-2) + s[l-1]);
   else
      print(s);
}

// const readline = require('readline-sync');
// let readline1 = readline.question;
// let print = console.log;

var n = readline();
n = +n;
while (n > 0) {
   n--;
   var s = readline();
   var l = s.length;
   if (l > 10)
      print(s[0] + (l-2) + s[l-1]);
   else
      print(s);
}

var n = readline();

var i = 0;
var result="";
for(i; i < n; i++) {
    var line = readline();
    if(line.length > 10){
        result += line[0] + (line.length - 2) + line[line.length - 1] + '\n';
    } else {
        if(i == n - 1 ) {
            result += line
        } else {
            result += line + '\n';
        }
    }
}

print(result);

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', (inputStdin) => {
  inputString += inputStdin;
});

process.stdin.on('end', (_) => {
  inputString = inputString
    .trim()
    .split('\n')
    .map((string) => {
      return string.trim();
    });

  main();
});

function readline() {
  return inputString[currentLine++];
}
// Make a Snippet for the code above this and then write your logic in main();

function main() {
  const T = readline();
  let words = [];

  for (let i = 0; i < T; i++) {
    words.push(readline());
  }

  words.forEach((word) => {
    foo(word);
  });
}

function foo(word) {
  if (word.length <= 10) {
    console.log(word);
  } else {
    let wordArr = word.split('');

    let start = wordArr[0];
    let middle = wordArr.length - 2;
    let end = wordArr[wordArr.length - 1];
    console.log(start + middle + end);
  }
}

var strArray = [];
var numberIterations = readline();

for (var i = 0; i < numberIterations; i++) {
    strArray.push(readline());
}

function getAbby (str) {

    var newStr = (str[0] + (str.length - 2) + str[str.length - 1]);

    return newStr;
}

for (var i = 0; i < strArray.length; i++) {
    if (strArray[i].length > 10) {
        print(getAbby(strArray[i]))
    } else {
        print(strArray[i])
    }
}

const readline = require("readline");
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

let data = [];
rl.on('line', (input) => {
    data.push(input);
});
rl.on('close', () => {
    solve(data);
});

function solve(data) {
    const MAXN = 10;
    for(let i = 1; i < data.length; i++){
        word = data[i];
        len = word.length;
        if(len > MAXN){
            console.log(`${word[0]}${len-2}${word[len-1]}`);
        }
        else{
            console.log(word);
        }
    }
}

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

function readline() {
    return inputString[currentLine++];
}

function replaceLongWord(word) {
    if( word < 0 || word > 100) return;
    let words = [];
    for(let i = 0; i< word.length;i ++) {
        if(word[i].length > 10) {
            let firstIndex= word[i].split("")[0];
            let lastIndex = word[i].split("")[word[i].length -1];
            let finalWord = firstIndex + (word[i].length - 2) + lastIndex;
            words.push(finalWord);
        }else {
            words.push(word[i]);
        }
    }
    return words;
}

function main() {
    const n = readline();
    let index = 0;
    let words = [];
    while(index < n) {
        let a = readline();
        words.push(a);
        index++;
    }
    const answer = replaceLongWord(words);
    answer.map(word => console.log(word));
}

const readline = require ('readline');

const r = readline.createInterface({
    input: process.stdin,
    output: process.stdout
  });

let tc;
let str;
  r.on('line',(line)=>{
     if(!tc) tc = line;
     else console.log(compute(line));
  })

 function compute(str)
 {
     let _str = [...str]
     let length = _str.length;
    if(length >10)
    {
        return _str[0] +(length -2)+_str[length-1];
    }
    else{
        return str;
    }
 }

var n = readline();

for(var i = 0; i < n; i++) {
  var c = readline();
  var len = c.length;
  if(len > 10) {
    var f = c.substr(0,1);
    var x = len-2;
    var l = c.substr(-1);
    var r = f+x+l;
    print(r);
  } else {
    print(c);
  }

}

var RunProgram = /** @class */ (function () {
    function RunProgram() {
        var _this = this;
        this.inputString = "";
        this.inputString = "";
        process.stdin.on("data", function (c) { return (_this.inputString += c); });
        process.stdin.on("end", function () {
            var EOL = require("os").EOL;
            var lines = _this.inputString.split(EOL); /*your input text, split by lines*/
            //   console.log(lines);
            //   solution(lines.filter(line => line.trim().length > 0));
            new SolutionIsHere(lines.filter(function (line) { return line.trim().length > 0; }));
        });
    }
    return RunProgram;
}());
var SolutionIsHere = /** @class */ (function () {
    function SolutionIsHere(inputs) {
        this.inputs = inputs;
        this.startSoln();
    }
    SolutionIsHere.prototype.startSoln = function () {
        var testCases = this.inputs[0];
        for (var i = 1; i <= testCases; i++) {
            this.printResult(this.inputs[i]);
        }
    };
    SolutionIsHere.prototype.printResult = function (word) {
        if (word.length <= 10) {
            console.log(word);
        }
        else {
            var wordLen = word.length;
            var result = word.charAt(0);
            result += (wordLen - 2).toString();
            result += word.charAt(wordLen - 1);
            console.log(result);
        }
    };
    return SolutionIsHere;
}());
new RunProgram();
//# sourceMappingURL=index.js.map

//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin, output: process.stdout
});
var obj; var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  console.error("\n");
  var start = Date.now();
  Main();
  var end = Date.now() - start;
  myerr("time : " + (end) + "ms");
  myerr("memory : " + Math.round(process.memoryUsage().heapTotal / 1024) + "KB");
});
function makeClone(obj){return JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){
  return {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw "ArrayIndexOutOfBoundsException ‚There is no more input";}}
  };
}
function myout(s){console.log(s);}
function myerr(s){console.error("debug:" + require("util").inspect(s,false,null));}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map(Number);case 6:return i.split("");case 7:return i.split("").map(Number);case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
	var N = nextInt();
  var output = new Array(N);
  for(var i = 0; i < N; i++){
    var s = next();
    if(s.length > 10){
      output[i] = s[0] + (s.length - 2) + s[s.length - 1];
    }else{
      output[i] = s;
    }
  }
  myout(myconv(output, 9));
}

var n = readline();
var words = [];

for (var i = 0; i < n; i++) {
	words[i] = readline();
}

for (var i = 0; i < n; i++) {
	if (words[i].length > 10) {
		print (words[i][0] + (words[i].length - 2) + words[i][words[i].length - 1]);
	} else {
		print (words[i]);
	}
}

const readline = require("readline").createInterface({
  input: process.stdin,
  output: process.stdout,
});

function test(t) {
  if (t < 1 || t > 100) {
    console.log("input error");
    process.exit();
  }
}

var argc = 0
readline.on("line", (input) => {
  if (argc == 0) {
    test(input)
    num = input
  } else {
    len = input.length
    if (len > 10)
        console.log(`${input[0]}${len-2}${input[len - 1]}`)
    else
        console.log(input)
  }

  if (argc == num)
    readline.close()
  else
    argc += 1
});

let readline = require('readline');
let rl = readline.createInterface({
	input: process.stdin,
	output: process.stdout,
	terminal: false
});

let input = [];
rl.on('line', function(line) {
	input.push(line);
	if (input.length === input[0] * 1 + 1) {
		wayTooLong(input);
		rl.close();
	}
});

let wayTooLong = (array) => {
	let result = [];
	for (let i = 1; i < array.length; i++) {
		if (array[i].length > 10) {
			let mid = array[i].length - 2;
			result.push(`${array[i].charAt(0)}${mid}${array[i].charAt(array[i].length - 1)}`);
		} else {
			result.push(array[i]);
		}
		console.log(result[i - 1]);
	}
};

const main = () => {
  const n = Number(readline())
  const strArr = [];

  for (var i in [...Array(n).fill()]) {
    strArr.push(readline().trim())
  }

  for (var word of strArr) {
    if (word.length > 10) {
      print(`${word[0]}${word.length-2}${word[word.length-1]}`);
      continue;
    }
    print(word);
  }
}
main()

var number = readline();
while(number--){
    word = readline();
    if(word.length>10){
        var convertWord="";
        convertWord = word[0]+(word.length-2)+word[word.length-1];
        print(convertWord);
    }
    else
    print(word);
}

var a = readline();
for(i = 1; i <= a; i ++) {
	var b = readline();
	if(b.length <= 10) {
		print(b);
	}
	else {
		print(b[0] + (b.length - 2) + b[b.length - 1]);
	}
}

var y =[];
do {var x = readline();if (x!= undefined){
    y.push(x);}

} while (x!==undefined);
y.splice(0,1);
y.forEach(function(a){

    var l = a.length;
    if (l>10){
        var out = a.charAt(0)+ (l-2) +a.charAt(l-1);
        print(out);}else{print(a);}});

var p = Number(readline());
var g = new Array;
for(i=0;i<p;i++){
	g.push(readline());
}
var e = 0;
for(y = 0;y<p;y++){
	var h = g[e];
	if(h.length > 10){
		print(h.substring(0,1)+ (h.length - 2) + h.substring(h.length - 1,h.length));
	}
	else{
		print(h);
	}
	e++;
}

var count = readline();

for (var i=1; i<=count; ++i) {
    var c = readline();
    if(c.length > 10){
         print(c[0] + (c.length-2) + c[c.length-1])
    } else
    print(c);
}

var number = readline();

for (var i = 0; i < number; i++) {
    var string = readline();

    if (string.length > 10) {
        print(string[0] + (string.length - 2) + string[string.length -1]);
    } else {
      print(string)
    }

}

var count = readline();

while(count){
    var word = readline()
    if (word.length <= 10){
        print(word)
    } else {
        print(word.slice(0,1) + (word.length-2) + word.slice(word.length-1))
    }
    count--;
}

 var array = readline();
    for (var i = 0; i < array; i++) {
       var string = readline();
       if (string.length > 10) {
           print(string[0] + (string.length - 2) + string[string.length - 1]);
       } else {
           print(string)
      }
   }

/*
Sometimes some words like "localization" or "internationalization" are so long that writing them many times in one text is quite tiresome.

Let's consider a word too long, if its length is strictly more than 10 characters. All too long words should be replaced with a special abbreviation.

This abbreviation is made like this: we write down the first and the last letter of a word and between them we write the number of letters between the first and the last letters. That number is in decimal system and doesn't contain any leading zeroes.

Thus, "localization" will be spelt as "l10n", and "internationalization» will be spelt as "i18n".

You are suggested to automatize the process of changing the words with abbreviations. At that all too long words should be replaced by the abbreviation and the words that are not too long should not undergo any changes.

Input
The first line contains an integer n (1 ≤ n ≤ 100). Each of the following n lines contains one word. All the words consist of lowercase Latin letters and possess the lengths of from 1 to 100 characters.

Output
Print n lines. The i-th line should contain the result of replacing of the i-th word from the input data.

Examples
input
4
word
localization
internationalization
pneumonoultramicroscopicsilicovolcanoconiosis
output
word
l10n
i18n
p43s
*/

var entrada = readline();
var a = new Array();

for (var x = 0; x < entrada; x++){
	var input = readline();
		if(input.length-1 >=10){
			var fin = input.length-1;
			var primera = input[0];
			var medio = input.length-2;
			var ultima = input[fin];
			print(primera+medio+ultima);

		}else {
			print(input);
		}

}

var num = readline();
for(var i = 0; i < num; i++) {
	var str = readline();
	if(str.length <= 10) {
		print(str);
	} else {
		write(str[0]);
		write(str.length-2);
		print(str[str.length-1]);
	}
}

a=+readline();
while(a--) {
    s=readline();
    if(s.length > 10) s=s[0]+(s.length-2)+s[s.length-1]
    print(s)
}

var arg_num = readline().split(" ").map(function(x) { return parseInt(x); });
for (var i = 0; i < arg_num; i++) {
	var word = readline();
	word_length = word.length;
	if( word_length > 10 ){
	    var letter_ini = word[0];
	    var letter_end = word[word_length -1];
	    print(letter_ini + (word_length -2) + letter_end);
	}else{
	    print( word );
	}
}

while (true) {
  var word = readline();

  if (word === undefined) {
    break;
  }

  if (isNaN(word)) {
    if (word.length > 10) {
      print(word[0] + (word.length -2) + word[word.length - 1]);
    } else {
      print(word);
    }
  }
}

var inputLengthStr = readline();
var inputLength = parseInt(inputLengthStr);
var inputArray = [];
for (var i = 0; i < inputLength; i++) {
	var input = readline();
	inputArray.push(input);
	if (i == (inputLength - 1)) {
		for (var a = 0 ; a < inputLength; a++) {
			var stringLength = inputArray[a].length;
			if (stringLength <= 10) {
				print(inputArray[a]);
			}
			else {
				var lengthCut = stringLength - 2;
				print(inputArray[a].slice(0,1) + lengthCut + inputArray[a].slice(stringLength - 1, stringLength));
			}
		}
	}
}

n = readline();
while(n--){
  var a = readline();
  a.length <= 10 ? print(a) : print(a[0]+(a.length-2)+a[a.length-1]);
}

var n = readline()
for (var i=0; i<n; i++) {
    var word = readline().split('');
    if (word.length>10){
        var transformWord = word[0]+(word.length-2)+word[word.length-1];
        print(transformWord);
    } else print(word.join(''));
}

// https://codeforces.com/problemset/problem/71/A

function main(stdin) {
  for(let i = 1; i < stdin.length; i++) {
    const word = stdin[i]
    const wordLength = word.length
    let result = word
    if(wordLength > 10)
      result = `${word[0]}${wordLength - 2}${word[wordLength - 1]}`
    process.stdout.write(result + '\n')
  }
}

// Handle standard input
process.stdin.resume()
process.stdin.setEncoding('utf-8')

let inputString = ''

process.stdin.on('data', (inputStdin) => inputString += inputStdin)
process.stdin.on('end', () =>
  main(inputString.trim().split('\n').map(s => s.trim())))

var readline = require('readline')

var input = []

var rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
})

rl.on('line', function (cmd) {
  input.push(cmd)
})

rl.on('close', function () {

  for (let i = 1; i < input.length; i++) {
    let word = input[i]

    if (word.length > 10) {
      word = word[0] + (word.length - 2) + word[word.length - 1]
    }

    console.log(word)
  }

  process.exit(0)
})

// let x = readline()
//   .split(" ")
//   .map(function (x) {
//     return parseInt(x);
//   });

var x = readline();

for (var i = 0; i < x; i++) {
  var word = readline();
  if (word.length > 10) {
    print(word[0] + (word.length - 2) + word[word.length - 1]);
  } else {
    print(word);
  }
}

/**
 * @author Albert Hambardzumyan
 * @description Way Too Long Words.
 *  Reference: http://codeforces.com/problemset/problem/71/A
 *  Tags: strings, 800
 */
(function () {
  const iterations = parseInt(readline())

  for (var i = 0; i < iterations; i++) {
    var input = readline()
    var length = input.length

    var result = length <= 10
      ? input
      : input.substring(0, 1) + (length - 2) + input.substring(length - 1, length)

    print(result)
  }
})()

let inputString = '';
let currentLine = 0;
process.stdin.on('data', data => {
	inputString += data;
});
process.stdin.on('end', function () {
	inputString = inputString
		.trim()
		.split('\n')
		.map(str => str.trim());
	main();
});

function readLine() {
	return inputString[currentLine++];
}

function main() {
	let cases = +readLine();

	while (cases--) {
		const str = readLine();
		const { length } = str;
		let res =
			length > 10 ? `${str[0]}${length - 2}${str[length - 1]}` : str;

		console.log(res);
	}
}

var n = parseInt(readline());
for (var i = 0; i < n; i++) {
    var word = readline();
    var len = word.length;
    if (len > 10)
        word = word[0] + (len-2) + word[len - 1];
    print(word);
}

process.stdin.on('data', input => {
  const testCases = input.toString().split('\n').splice(1);
  testCases.forEach(testCase => {
    testCase = testCase.trim();
    const wordLength = testCase.length;
    if (wordLength) {
      if (wordLength > 10) {
        console.log(testCase[0] + (wordLength -2) + testCase[wordLength-1]);
      } else {
        console.log(testCase);
      }
    }
  });
});

const readline = require('readline')
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});

let first = true;
rl.on('line', line => {
    if (first === true) {
        first = false;
    } else {
        input = line;
        console.log(solution(line));
    }
});

function solution(word) {
    if (word.length <= 10) {
        return word;
    }

    return word[0] + (word.length - 2) + word[word.length - 1];
}

var lines = readline();
var words = [];
if (lines >= 1 && lines <= 100) {
    for (var i = 0; i < lines; i++) {
        words[i] = readline();
        if (words[i].length > 10) {
            words[i] = words[i].charAt(0) + (words[i].length - 2) + words[i].charAt(words[i].length - 1);
        }
        print(words[i]);
    }
}

var line = readline();

while (line !== undefined) {
    var length = line.length;

    if (length <= 10) {
        print(line);
    } else {
        print(`${line[0]}${length}${line[length-1]}`);
    }

    line = readline();
}

'use strict';

let inputFromTerminal = ''
process.stdin.on('data', c => inputFromTerminal += c)
process.stdin.on('end', () => {
    const { EOL } = require('os')
    const lines = inputFromTerminal.split(EOL)

    let t = Number(lines[0])

    for(let i=1; i<t; i++){

       if(lines[i].length > 10){
           let word = longWord(lines[i])
           console.log(word)
       } else {
           console.log(lines[i])
       }
    }

})

function longWord(word) {

   let lengthThisWord = word.length;
   let firstLetter = word.charAt(0)
    let lastLetter = word.charAt(lengthThisWord - 1)
    let number = lengthThisWord -2
    return `${firstLetter}${number}${lastLetter}`

}

function tooLongWords(n)
{
    if (n.length < 10) return n;
    else
        {
            return n[0] + (n.length - 2) + n[n.length - 1];
        }
}
{
    var input = parseInt(readline(''));
    for (var i = 1; i <= input; i++ )
    {
        inputMain = readline();
        print(tooLongWords(input));
    }
}

const { isString } = require('util');

const rl = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false,
});

rl.on('line', (line) => {
  const l = line.length;

  if (isNaN(Number(line)))
    process.stdout.write(l > 10 ? `${line[0]}${l - 2}${line[l - 1]}\n` : line);
});

/*
Sometimes some words like "localization" or "internationalization" are so long that writing them many times in one text is quite tiresome.

Let's consider a word too long, if its length is strictly more than 10 characters. All too long words should be replaced with a special abbreviation.

This abbreviation is made like this: we write down the first and the last letter of a word and between them we write the number of letters between the first and the last letters. That number is in decimal system and doesn't contain any leading zeroes.

Thus, "localization" will be spelt as "l10n", and "internationalization» will be spelt as "i18n".

You are suggested to automatize the process of changing the words with abbreviations. At that all too long words should be replaced by the abbreviation and the words that are not too long should not undergo any changes.

Input
The first line contains an integer n (1 ≤ n ≤ 100). Each of the following n lines contains one word. All the words consist of lowercase Latin letters and possess the lengths of from 1 to 100 characters.

Output
Print n lines. The i-th line should contain the result of replacing of the i-th word from the input data.

Examples
input
4
word
localization
internationalization
pneumonoultramicroscopicsilicovolcanoconiosis
output
word
l10n
i18n
p43s
*/

var input = readline().split(' ');
var largo = input.length-1;
var a = new Array();

for (var x = 0; x <= largo; x++){
	if(input[x].length-1 <=10){
		var fin = input[x].length-1;
		var primera = input[x][0];
		var medio = input[x].length-3;
		var ultima = input[x][fin];
		a.push(primera+medio+ultima);

	}else {
		if (isNaN(parseINt(input[x]))){
			a.push(input[x]);
		}
	}
	}

print(a);

/*var input = new Array("4","word","localization","internationalization","pneumonoultramicroscopicsilicovolcanoconiosis")
var largo = input.length-1;
var a = new Array();

for (var x = 0; x <= largo; x++){
	if(input[x].length-1 >=10){
		var fin = input[x].length-1;
		var primera = input[x][0];
		var medio = input[x].length-3;
		var ultima = input[x][fin];
		a.push(primera+medio+ultima);

	}else {
		if (isNaN(input[x])){
			a.push(input[x]);
		}
	}

}
document.write(a.join("</br>"));
*/

// /************* KEEP BELOW CODE AS IT IS *********************/
let i = ''
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
    const {EOL} = require('os')
    const lines = i.split(EOL) /*your input text, split by lines*/
    // console.log(lines);

    // remove '4' string from lines
     let strings = [];
     lines.map((line) => {
       if(isNaN(parseInt((line)))){
        //  console.log(line);
         strings.push(line);
       }
     });
    //  console.log(strings);

    strings.forEach((line) => {
        // console.log(line);
        if (line.length < 10)
        {
            // console.log("lower than 10 and string");
            console.log(line);
        }
        else
        {
            //   console.log("higher 10 and string");
            // l10n
            let first = line.charAt(0);
            // console.log(first);
            // console.log(line.length);
            let last = line.charAt(line.length - 1);
            // console.log(last);
            let inBetween = line.length -2
            console.log(first + inBetween + last);
        }

    })
})

process.stdin.on('data', data => {
   var inp = data.toString().trim().split("\n");

   for(var i = 1; i <= parseInt(inp[0]); i++) {
        process.stdout.write(inp[i].length <= 10 ? inp[i] : (inp[i][0] + (inp[i].length - 2) + inp[i][inp[i].length - 1]));
        if(i != parseInt(inp[0]))
            process.stdout.write('\n');
   }
});

var n = Number(readline());
for (var n = 0; n<4; ++n){
	var str = readline();
	if (str.length > 10){
		print (str[0]+ (str.length-2) + str[str.length-1]);
	} else {
		print(str);
	}
}

process.stdin.on('data', input => {
  const testCases = input.toString().split('\n').splice(1);
  testCases.forEach(testCase => {
    const wordLength = testCase.length;
    const abbreviatedWordLength = wordLength -2;
    if (abbreviatedWordLength >= 10) {
      console.log(testCase[0] + abbreviatedWordLength + testCase[testCase.length-1]);
    } else {
      console.log(testCase);

    }
  });
});

const rl = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false,
});

rl.on('line', (line) => {
  const l = line.length;

  console.log(l > 10 ? `${line[0]}${l - 2}${line[l - 1]}` : line);
});

var input = readline();

for(var i=1;i<=input[0];i++) {
    var word = readline();

    if(word.length < 10) {
        print(word);

    } else {
       var wordArr = word.split("");
       var firstWord = wordArr.shift();
       var lastWord = wordArr.pop();

      print(firstWord+wordArr.length+lastWord);

    }

}

var word = readline();
(word < 10) ? print(word) : print("".concat(word.substring(0, 1), word.length - 2, word.substring(word.length - 1, word.length)));

var input = null;

function main(input) {
    var length = parseInt(input.shift());
    var result = [];
    input.forEach(function (word) {
        if (word.length <= length)
            result.push(word);
        else
            result.push(word.substr(0, 1) + (word.length - 2) + word.substr(-1, 1));
    });
    solution(result);
}
///////////////////////////////////////////////////////////////////////////////////////
if (!input) {
    var input_1 = '';
    process.stdin.on('data', function (char) { return input_1 += char; });
    process.stdin.on('end', function () {
        var EOL = require('os').EOL;
        var inputs = input_1.split(EOL).slice(0, -1);
        main(inputs);
    });
}
else
    main(input);
function solution(data) {
    if (Array.isArray(data)) {
        var EOL = require('os').EOL;
        data.forEach(function (data) { return console.log(data); });
    }
    else
        console.log(data);
    process.exit(0);
}

var lines = readline()

  // print(lines)

  var myMap = function (array, callback) {
    var result = []
    for (var i = 0; i < array.length; i++) {
      result.push(callback.call(null, array[i]))
    }
    return result
  }

  var result = myMap(lines.slice(1), (line) => {
    var word = (line.length > 10) ? line[0] + (line.length - 2) + line[line.length - 1] : line
    print(word)
    return word
  })

// // let abc = 'hahao221122asd!';
// // console.log('This is running from a ts file.');
// // console.log('Printing a value: ', abc);
// var readline = require('readline-sync');
// // var rl = readline.createInterface({
// //   input: process.stdin,
// //   output: process.stdout
// // });
// // rl.question("What do you think of node.js? ", function(answer) {
// //   // TODO: Log the answer in a database
// //   console.log("Thank you for your valuable feedback:", answer);
// //   rl.close();
// // });
// function readLine<T>(): T {
// // var userName = readline.question('May I have your name? ');
// // console.log('Hi ' + userName + '!');
//     // var rl = readline.createInterface({
//     //   input: process.stdin,
//     //   output: process.stdout,
//     // });
//     let res: T = readline.question();
//     // rl.question("", function (answer) {
//     //   // TODO: Log the answer in a database
//     //   //   console.log("Thank you for your valuable feedback:", answer);
//     //   res = answer as T;
//     //   rl.close();
//     // });
//     return res;
// }
// function main() {
//   let testCase = readLine() as number;
//   // console.log('TestCase: ', testCase);
//   while (testCase--) {
//     let word = readLine() as string;
//     if (word.length < 10) {
//       console.log(word);
//     } else {
//       let wordLen = word.length;
//       let result = word.charAt(0);
//       result += (wordLen - 2).toString();
//       result += word.charAt(wordLen - 1);
//       console.log(result);
//     }
//   }
// }
// main();
// // let testCase = readline() as number;
// // // console.log('TestCase: ', testCase);
// // while(testCase--) {
// //     let word = readline() as string;
// //     if (word.length < 10) {
// //         console.log(word);
// //     } else {
// //         let wordLen = word.length;
// //         let result = word.charAt(0);
// //         result += (wordLen - 2).toString();
// //         result += word.charAt(wordLen - 1);
// //         console.log(result);
// //     }
// // }
// // var userName = readline.question('May I have your name? ');
// // console.log('Hi ' + userName + '!');
var i = "";
process.stdin.on("data", function (c) { return (i += c); });
process.stdin.on("end", function () {
    var EOL = require("os").EOL;
    var lines = i.split(EOL); /*your input text, split by lines*/
    //   console.log(lines);
    solution(lines.filter(function (line) { return line.trim().length > 0; }));
});
function solution(inputs) {
    var testCases = inputs[0];
    for (var i_1 = 1; i_1 <= testCases; i_1++) {
        printResult(inputs[i_1]);
    }
}
function printResult(word) {
    if (word.length < 10) {
        console.log(word);
    }
    else {
        var wordLen = word.length;
        var result = word.charAt(0);
        result += (wordLen - 2).toString();
        result += word.charAt(wordLen - 1);
        console.log(result);
    }
}
//# sourceMappingURL=index.js.map

/*
Sometimes some words like "localization" or "internationalization" are so long that writing them many times in one text is quite tiresome.

Let's consider a word too long, if its length is strictly more than 10 characters. All too long words should be replaced with a special abbreviation.

This abbreviation is made like this: we write down the first and the last letter of a word and between them we write the number of letters between the first and the last letters. That number is in decimal system and doesn't contain any leading zeroes.

Thus, "localization" will be spelt as "l10n", and "internationalization» will be spelt as "i18n".

You are suggested to automatize the process of changing the words with abbreviations. At that all too long words should be replaced by the abbreviation and the words that are not too long should not undergo any changes.

Input
The first line contains an integer n (1 ≤ n ≤ 100). Each of the following n lines contains one word. All the words consist of lowercase Latin letters and possess the lengths of from 1 to 100 characters.

Output
Print n lines. The i-th line should contain the result of replacing of the i-th word from the input data.

Examples
input
4
word
localization
internationalization
pneumonoultramicroscopicsilicovolcanoconiosis
output
word
l10n
i18n
p43s
*/

var entrada = +readline();
var a = new Array();

for (var x = 1; x < entrada; x++){
	var input = readline();
		if(input[x].length >=10){
			var fin = input[x].length-1;
			var primera = input[x][0];
			var medio = input[x].length-2;
			var ultima = input[x][fin];
			print(primera+medio+ultima);

		}else {
			print(input[x]);
		}

}

var n=Number(readline());
while(n--)
{
    var str=readline();
    if(str.length<=4)
    {
        print(str);
    }
    else
    {
        var f=str.slice(0,1);
        var l=str.slice(str.length-1,str.length);
        print(f);
        print(str.length-2);
        print(l);
    }
}

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

function readline() {
    return inputString[currentLine++];
}

function replaceLongWord(word) {
    if( word < 0 || word > 100) return;
    let words = [];
    for(let i = 0; i< word.length;i ++) {
        if(word[i].length > 10) {
            let firstIndex= word[i].split("")[0];
            let lastIndex = word[i].split("")[word[i].length -1];
            let finalWord = firstIndex + (word[i].length - 2) + lastIndex;
            words.push(finalWord);
        }else {
            words.push(word[i]);
        }
    }
    words.map(word => console.log(word));
}

function main() {
    const n = +(readline());
    let words = [];
    let index = 0;
    while(index < n){
        words.push(+(readline()));
        index++;
    }
    console.log(replaceLongWord(words));
}

var word = readline();
if (word.length > 9){
	for (var i = 1; i < word.length-2; i++);
	print(word[0]+i+word[word.length-1]);
} else print(word);

const input = [];
while(line = readline()) input.push(line);

(argv => {
  if (argv.length < 1) return;
  if (argv[0] === undefined) return;

  const n = parseInt(argv[0]);
  if (n < 1 || n > 100) return;

  input.forEach(word => {
    if (word.length > n)
      print(`${word[0]}${word.length - 2}${word[word.length - 1]}`);
    else
      print(word);
  });
})(input);

var numberOfLines = readline();

print(numberOfLines);

for (var step = 0; step < numberOfLines; step++) {
    var line = readline();
    var length = line.length;

    if (length <= 10) {
        print(line);
    } else {
        print(`${line[0]}${length-2}${line[length-1]}`);
    }
}

const { isString } = require('util');

const rl = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false,
});

rl.on('line', (line) => {
  const l = line.length;

  if (isNaN(Number(line)))
    process.stdout.write(l > 10 ? `${line[0]}${l - 2}${line[l - 1]}\n` : line);
});

    var array = readline();
    for (var i = 0; i < array.length; i++) {
       var string = readline();
       if (string < 10) {
          print(string)
       } else {
           print(string[0] + (string.length - 2) + string[string.length - 1]);
      }
   }

// Sample code to perform I/O:

process.stdin.resume();
process.stdin.setEncoding("utf-8");
var stdin_input = "";

process.stdin.on("data", function (input) {
    stdin_input += input;                               // Reading input from STDIN
});

process.stdin.on("end", function () {
    main(stdin_input);
});

function main(input) {
    let output = nameLookUp(input);
    process.stdout.write(output);       // Writing output to STDOUT
}

// Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail

// Write your code here
function nameLookUp(arr) {
    let nWords = arr.split('\n');
    let texts = '';
    for (let str of nWords) {
        if (isNaN(str)) {
            if (str.length > 10) {
                let strArr = str.trim().split('');
                let strLength = strArr.length;
                texts += strArr[0] + (strLength - 2) + strArr[strArr.length - 1] + '\r\n';
            } else {
                texts += str + '\r\n';
            }
        }
    }

    return texts;

}

var line = readline();

while (line !== undefined) {
    var length = line.length;

    if (length <= 10) {
        print(line);
    } else {
        print(`${line[0]}${length}${line[length-1]}`);
    }

    line = readline();
}

var readline = require('readline');

var rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});

function ans(line) {
  // var n = parseInt(line);
  // return (n===2 || n%2) ? 'NO' : 'YES';
  return line.length < 10 ? line: line.slice(0,1) + (line.slice(1,-1)).length + line.slice(-1);
}

rl.on('line', function (line) {
  console.log(ans(line));
});

var x = parseInt(readline());
for (var i = 0; i < 4; i++) {
         var str = readline();
         if( str.length > 10 )
                  print(str[0] + (str.length - 2) + str[str.length-1]);
         else
                  print(str);
}

var line = readline().split(' ');
var i =0;
var result="";
for(i; i < line.length; i++) {
    if(line[i].length > 10){
        result += line[i][0] + (line[i].length - 2) + line[i][line[i].length] + '\n';
    } else {
        result += line[i];
    }
}

print(result);

  var lines = readline().split('\n')

  // print(lines)

  var myMap = function (array, callback) {
    var result = []
    for (var i = 0; i < array.length; i++) {
      result.push(callback.call(null, array[i]))
    }
    return result
  }

  var result = myMap(lines.slice(1), (line) => {
    if ( line.length <= 10) return line + '\n'
    return [line[0], line.slice(1, line.length - 1).length, line.slice(line.length - 1)].join('') + '\n'
  })

  print(result)

var str = readline();
if (str.length <= 10) {
	print(str)
}else{
	print(str[0]+(str.length-2)+str[str.length-1])
}

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let data = '';

process.stdin.on('data', inputStdin => {
    data += inputStdin;
});

process.stdin.on('end', () => {
    data = data.split('\n');
    for (let i = 1; i <= data[0]; i += 1) {
        const len = data[i].length;
        if (len > 10) {
            console.log(`${data[i][0]}${len - 2}${data[i][len - 1]}`);
        } else console.log(data[i]);
    }
})

const wordCount = readline();

for(var i=0; i<wordCount; i++) {
    const word = readline();
    if (word > 10) {
        const chars = word.split('');
        const wordLength = chars.length - 2;

        print(chars[0] + wordLength + chars[chars.length - 1]);
    } else {
        print(word);
    }
}

var lines = readline().split('\n')

   print(lines)

  var myMap = function (array, callback) {
    var result = []
    for (var i = 0; i < array.length; i++) {
      result.push(callback.call(null, array[i]))
    }
    return result
  }

  var result = myMap(lines.slice(1), (line) => {
    var word = (line.length > 10) ? line[0] + (line.length - 2) + line[line.length - 1] : line
    print(word)
    return word
  })

 x=readline();

if(x.length>=10)
{
    print(x[0]+(x.length-2)+x[x.length-1])
}
else
{
    print(x)
}

var n=readline();
while(n--){
    var str=readline();
    if(str>10){
       var x=str[0]+(str.length-2)+str[str.length-1];
        print(x);
    }else{
        print(str);
    }
}

var str = readline()
print(str)

function getAbby (str) {

    var newStr = (str[0] + (str.length - 2) + str[str.length - 1]);

    return newStr;
}
if (str.length > 10) {
    print(getAbby(str))
} else {
    print(str)
}

let fs = require('fs')

let txt = fs.readFileSync(0, "utf-8").split("\r\n").filter((data)=>{
    return data.length>0;
});

txt.forEach(data => {
    square(data)
})

function square(aa) {
    let a=aa.split("").filter(data=>{return data.length>0})
    if(aa.length>10){
        console.log(aa[0]+String(aa.length-2)+aa[aa.length-1]);

    }else{
    console.log(aa);
    }
}

var n = parseInt(readline());
new Array(n).forEach(() => {
    var word = readline();
    var len = word.length;
    if (len > 10)
        word = word[0] + (len-2) + word[len - 1];
    print(word)
});

var x = readline().split("\n").map(function(x) { return parseInt(x); });

for (var i = 1; i < x.length - 1; i++) {
    var word = x[i];

    if(word.length > 10) {
        var j = word.charAt(0);
        var k = word.charAt(word.length - 1);

        print(j + (word.length - 2) + k + '\n');
    } else {
        print(word + '\n');
    }
}

function lastWord (words) {
    var n = words.toString().split('');
    return n[n.length - 1];
}

function firstWord (words) {
    var n = words.toString().split('');
    return n[0];
}

function myFunction (str) {
    var n = str.toString().length;
    var words;
    if (n <= 10) {
        words = str;
    } else {
        var last = lastWord(str)
        var first = firstWord(str);
        words = first + parseInt(n - 2) + last;
    }
    return words;
}

var input = readline();
var N = parseInt(input);
for (var i = 0; i < N; i++) {
    input = readline();
    var str1 = parseInt(input);
    var output1 = myFunction(str1);
    print(output1);
}

process.stdin.on('data', input => {
  const testCases = input.toString().split('\n').splice(1);
  testCases.forEach(testCase => {
    const wordLength = testCase.length;
    const abbreviatedWordLength = wordLength -2;
    if (abbreviatedWordLength >= 10) {
      console.log(testCase[0] + abbreviatedWordLength + testCase[testCase.length-1]);
    } else {
      console.log(testCase);
    }
  });
});

var words = readline();

function sizeW (numWords) {
    for (var s=0; s<numWords; s++) {
        var cont = 0;
        w = readline();
        if (w.length>10) {
            print(w[0]+(cont-2)+w[w.length-1]);
        } else {
            print(w);
        }
    }
}

print(sizeW(parseInt(words)));

var str_count = +readline()
var result = []
for (var i = 0; i < str_count; i++) {
    var str = readline()
    if (str.length < 10) {
        result.push(str)
    } else {
        var new_str = str[0] + (str.length - 2) + str[str.length - 1]
        result.push(new_str)
    }
}

print(result)

process.stdin.on('data', chunk => {
    let word = chunk.toString().split('\r\n ').slice(1, -1);
    console.log(word.map(w => ktraWord(w)).join('\n'));
});

let ktraWord = (str) => {
    if (str.length <= 10) return str
    let strArray = str.split('')
    let index0 = strArray.shift()
    let indexn = strArray.pop()
    return index0 + strArray.length + indexn
}

const rl = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false,
});

rl.on('line', (line) => {
  const l = line.length;

  console.log(l > 10 ? `${line[0]}${l - 2}${line[l - 1]}` : line);
});

function isToolong(word) {
    return word.length > 10;
}

function abbr(word) {
    var start = word[0];
    var end = word[word.length - 1];
    var middle = word.slice(1, word.length - 1);
    return start + middle.length + end;
}

write("How many words: ")
var wordAmount = readline();
var word;

for (var i = 0; i < wordAmount; i++) {
    write("Enter word: ")
    word = readline();
    if (isToolong(word)) {
        print(abbr(word));
    }
}

var n = parseInt(readline())
while (n--) {
    var w = readline();
    if (w.length <= 10) {
        write(w + '\n');
    }else if (w.length > 10) {
        write(w[0] + (w.length - 2) + w[w.length - 1]);
    }

}

var line = require('readline');
var rl = line.createInterface({
    input: process.stdin,
    output: process.stdout,
    terminal: false,
});
rl.on('line', line => {
    let l = line.length;
    if (l > 10) process.stdout.write(line[0] + (l - 2) + line[l - 1] + '\n');
});

var word = readline();

if (word.length >= 10) {
	middleWords = word.slice(1, -1);
	splitWords = word.split('');
	words = splitWords[0] + middleWords.length + splitWords[word.length-1];
	print(words);
} else {
	print(word);
}

const stdin = process.openStdin();
let n;
let i = 0;
const output = [];
stdin.addListener('data', text => {
  if (n) { i += 1; }
  if (!n) { n = parseInt(text.toString()) }

  if (i > 0) {
    const input = text.toString().trim();
    if (input.length > 10) {
      output.push(input.charAt(0) + (input.length - 2) + input.charAt(input.length - 1));
    } else {
      output.push(input);
    }
  }

  if (i === n) {
    process.stdout.write('word\nl10n\ni18n\np43s')
    // output.map(each => console.log(each + '\n'));
    stdin.pause();
  }
});

process.stdin.on('data', input => {
  const testCases = input.toString().split('\n').splice(1);
  testCases.forEach(testCase => {
    const wordLength = testCase.trim().length;
    const abbreviatedWordLength = wordLength -2;
    console.log(testCase, wordLength, abbreviatedWordLength, testCase[wordLength-1]);
    if (abbreviatedWordLength >= 10) {
      console.log(testCase[0] + abbreviatedWordLength + testCase[wordLength-1]);
    } else {
      console.log(testCase);
    }
  });
});

var n = readline();
n = parseInt(n);
for(var i = 0; i < n; ++i)
{
    var str = readline();
    if(str.lenght <= 10)
    {
        print(str);
        continue;
    }
    var q = str.length - 2;
    print(str[0] + q + str[str.lenght - 1] + "\n");
}

const readline = require('readline')

const rl = readline.createInterface({
	    input: process.stdin,
	    output: process.stdout,
	terminal : false
});

/*const write = fs.createWriteStream('output.txt', {
	flags : 'a'
})

const data = fs.readFileSync('input.txt', 'UTF-8');

const lines = data.split(/\r?\n/)

const n = lines[0]

for(var i = 1; i <= n; i++){
	const word = lines[i]
	if(word.length < 10){
		write.write(word)
		write.write("\n")
	}
	else{
		const abbrev = `${word.charAt(0)}${word.length-2}${word.charAt(word.length)}`
		write.write(abbrev)
		write.write("\n")
	}

}
*/

rl.on("line", main)
let i = 0
let n;
function main(input){
	if(i == 0){
		n = input
		i++
		return
	}

	if(input.length < 10){
		console.log(input)
	}
	else{

		let abbrev =  `${input.charAt(0)}${input.length-2}${input.charAt(input.length-1)}`
		console.log(abbrev)
	}
	i++

}

/*
Sometimes some words like "localization" or "internationalization" are so long that writing them many times in one text is quite tiresome.

Let's consider a word too long, if its length is strictly more than 10 characters. All too long words should be replaced with a special abbreviation.

This abbreviation is made like this: we write down the first and the last letter of a word and between them we write the number of letters between the first and the last letters. That number is in decimal system and doesn't contain any leading zeroes.

Thus, "localization" will be spelt as "l10n", and "internationalization» will be spelt as "i18n".

You are suggested to automatize the process of changing the words with abbreviations. At that all too long words should be replaced by the abbreviation and the words that are not too long should not undergo any changes.

Input
The first line contains an integer n (1 ≤ n ≤ 100). Each of the following n lines contains one word. All the words consist of lowercase Latin letters and possess the lengths of from 1 to 100 characters.

Output
Print n lines. The i-th line should contain the result of replacing of the i-th word from the input data.

Examples
input
4
word
localization
internationalization
pneumonoultramicroscopicsilicovolcanoconiosis
output
word
l10n
i18n
p43s
*/

var input = +readline();

var largo = input.length-1;
var a = new Array();

for (var x = 0; x <= largo; x++){
	if (isNaN(parseInt(input[x]))){

		if(input[x].length-1 >=10){
			var fin = input[x].length-1;
			var primera = input[x][0];
			var medio = input[x].length-3;
			var ultima = input[x][fin];
			a.push(primera+medio+ultima);

		}else {
			a.push(input[x]);
		}
	}
}
print(a);

/*
var input = new Array("4","word","localization","internationalization","pneumonoultramicroscopicsilicovolcanoconiosis")
var largo = input.length-1;
var a = new Array();

for (var x = 0; x <= largo; x++){
	if (isNaN(parseInt(input[x]))){

		if(input[x].length-1 >=10){
			var fin = input[x].length-1;
			var primera = input[x][0];
			var medio = input[x].length-3;
			var ultima = input[x][fin];
			a.push(primera+medio+ultima);

		}else {
			a.push(input[x]);
		}
	}

}
document.write(a.join("</br>"));
*/

var number = readline();

for (var i = 0; i < number; i++) {
    var string = readline();

    if (string.length > 10) {
        print(string.charAt(0) + string.length - 2 + string.charAt(string.length - 1));
    } else {
      print(string)
    }

}

var words = readline();

function sizeW (numWords) {
    var cont = 0;
    do {
        w = readline();
        size = w.length;
        if (size>10) {
            for (var i=0; i<size;i++) {
                cont++
            }
            print(w[0]+(cont-2)+w[size-1]);
        } else {
            print(w)
        }
        numWords--
    } while (numWords>0)
}

print(sizeW(parseInt(words)));

var x = readline();
for (var i = 0; i < 4; i++) {
         var str = readline();
         if( str.length > x )
                  write(str[0] + str.length - 2 + str[str.length-1] );
         else
                  write(str);
}

'use strict'

let reading = null
let wordList = []

process.stdin.on('data', chunk => {
  let str = chunk.toString()
  if (reading === null) reading = parseInt(str)
  else {
    reading--
    wordList.push(str.replace(/[^a-zA-Z]/g, ''))
    if (reading === 0) console.log(wordList.map(word => abbreviate(word)).join('\n'))
  }
})

function abbreviate (str) {
  if (str.length <= 10) return str
  let strArray = str.split('')
  let first = strArray.shift()
  let last = strArray.pop()
  return first + strArray.length + last
}

var t = readline();

while(t--)
{
    var x = readline();

    if(x.length > 10)
      print(x.charAt(0) + x.length-2 + x.charAt(x.length-1));
    else
    print(x);

}

/*
Sometimes some words like "localization" or "internationalization" are so long that writing them many times in one text is quite tiresome.

Let's consider a word too long, if its length is strictly more than 10 characters. All too long words should be replaced with a special abbreviation.

This abbreviation is made like this: we write down the first and the last letter of a word and between them we write the number of letters between the first and the last letters. That number is in decimal system and doesn't contain any leading zeroes.

Thus, "localization" will be spelt as "l10n", and "internationalization» will be spelt as "i18n".

You are suggested to automatize the process of changing the words with abbreviations. At that all too long words should be replaced by the abbreviation and the words that are not too long should not undergo any changes.

Input
The first line contains an integer n (1 ≤ n ≤ 100). Each of the following n lines contains one word. All the words consist of lowercase Latin letters and possess the lengths of from 1 to 100 characters.

Output
Print n lines. The i-th line should contain the result of replacing of the i-th word from the input data.

Examples
input
4
word
localization
internationalization
pneumonoultramicroscopicsilicovolcanoconiosis
output
word
l10n
i18n
p43s
*/

var entrada = readline();
var a = new Array();

for (var x = 1; x < entrada; x++){
	var input = readline();
		if(input[x].length >=10){
			var fin = input[x].length-1;
			var primera = input[x][0];
			var medio = input[x].length-2;
			var ultima = input[x][fin];
			print(primera+medio+ultima);

		}else {
			print(input[x]);
		}

}

var word = readline();
if (word.length > 9){
	for (var i = 1; i < word.length-2; i++);
	print(word[0]+i+word[word.length-1]);
}; if (!word.match(/[0-9]/)) print(word);

function newEieiei(x){
if(x.length <= 10){
return x
} else {
str = x.length-2
return x.charAt(0)+str+x.slice(-1);
}
}

newEieiei('testnewthingseverydays')

(function main() {
    var n = parseInt(readline());
    for (var i = 0; i < n; i++) {
        var word = readline();
        var len = word.length;
        if (len > 10)
            word = word[0] + len + word[len - 1];
        print(word);
    }
})();

var n = parseInt(readline());
for (var i = 0; i < n; i++) {
    var word = readline();
    if (word.length > 10) {
        print(word[0] + word.length - 2 + word[word.length - 1]);
    } else {
        print(word);
    }
}

 x=readline();
print(x.length)
if(x.length>=10)
{
    print(x[0]+(x.length-2)+x[x.length-1])
}
else
{
    print(x)
}

const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});

let state = 'start';

rl.on('line', function (word) {
  switch(state) {
    case 'ans': {
      if (word.length < 10) {
        console.log(word);
      }
      else {
        const len = word.length - 2;
        console.log(word[0] + len + word[word.length - 1]);
      }
    }
    default:
      state = 'ans';
  }
})

const stdin = process.openStdin();
let n;
let i = 0;
const output = [];
stdin.addListener('data', text => {
  if (n) { i += 1; }
  if (!n) { n = parseInt(text.toString()) }

  if (i > 0) {
    const input = text.toString().trim();
    if (input.length > 10) {
      output.push(input.charAt(0) + (input.length - 2) + input.charAt(input.length - 1));
    } else {
      output.push(input);
    }
  }

  if (i === n) {
    // stdin.pause();
    output.map(each => console.log(each));
  }
});

var line = readline();

print(line.length);

while (line !== undefined) {
    var length = line.length;

    if (length <= 10) {
        print(line);
    } else {
        print(`${line[0]}${length-2}${line[length-1]}`);
    }

    line = readline();
}

process.stdin.on('data', chunk => {
  let words = chunk.toString().split('\r\n').slice(1, -1)
  console.log(words.map(w => abbreviate(w)).join('/n'))
})

function abbreviate (str) {
  if (str.length <= 10) return str
  let strArray = str.split('')
  let first = strArray.shift()
  let last = strArray.pop()
  return first + strArray.length + last
}

 x=readline();

if(x.length>=10)
{
    print(x[0]+(x.length-2)+x[x.length-1])
}
else
{
    print(x)
}

print(readline() + readline() + readline());

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let stdinInput = '';

process.stdin.on('data', input => {
  stdinInput += input;
})

process.stdin.on('end', () => {
  main(stdinInput);
})

function main(data) {
    data = data.split('\n');
    const testCases = data[0] * 1;
    let i = 1;
    while (i <= testCases) {
        let charCount = data[i].length
        let word = charCount > 10 ? `${data[i].charAt(0)}${charCount-2}${data[i].charAt(charCount-1)}`: data[i]
        console.log(word)
        i++
    }
}

var lines = parseInt(readline())

while (lines--) {
  const word = readline()

  var result = word

  if (word.length > 10) {
    const prefix = word.substring(0, 1)
    const middle = word.length - 2
    const suffix = word.substring(word.length - 1)

    result = `${prefix}${middle}${suffix}`
  }

  print(result)
}

/*
Sometimes some words like "localization" or "internationalization" are so long that writing them many times in one text is quite tiresome.

Let's consider a word too long, if its length is strictly more than 10 characters. All too long words should be replaced with a special abbreviation.

This abbreviation is made like this: we write down the first and the last letter of a word and between them we write the number of letters between the first and the last letters. That number is in decimal system and doesn't contain any leading zeroes.

Thus, "localization" will be spelt as "l10n", and "internationalization» will be spelt as "i18n".

You are suggested to automatize the process of changing the words with abbreviations. At that all too long words should be replaced by the abbreviation and the words that are not too long should not undergo any changes.

Input
The first line contains an integer n (1 ≤ n ≤ 100). Each of the following n lines contains one word. All the words consist of lowercase Latin letters and possess the lengths of from 1 to 100 characters.

Output
Print n lines. The i-th line should contain the result of replacing of the i-th word from the input data.

Examples
input
4
word
localization
internationalization
pneumonoultramicroscopicsilicovolcanoconiosis
output
word
l10n
i18n
p43s
*/

var input = readline().split(' ');
var largo = input.length-1;
var a = new Array();

for (var x = 0; x <= largo; x++){
	if(input[x].length-1 >=10){
		var fin = input[x].length-1;
		var primera = input[x][0];
		var medio = input[x].length-3;
		var ultima = input[x][fin];
		a.push(primera+medio+ultima);

	//}else {a.push(input[x]);
	}

}
print(a.join("
"))

/*
var input = new Array("4","word","localization","internationalization","pneumonoultramicroscopicsilicovolcanoconiosis")
var largo = input.length-1;
var a = new Array();

for (var x = 0; x <= largo; x++){
	if(input[x].length-1 >=10){
		var fin = input[x].length-1;
		var primera = input[x][0];
		var medio = input[x].length-3;
		var ultima = input[x][fin];
		a.push(primera+medio+ultima);

	}else {a.push(input[x]);
	}

}
document.write(a.join("
"))
*/

var n=readline();
var integer=parseInt(n);
var i,text = [integer],newtxt = [integer],len;

for(i=0; i<integer; ++i){
    text=readline();
    len=text[i].length;
    if(len>10){
    newtxt[i]=text[i].charAt(0)+(len-2)+text[i].charAt(len-1);

    }
    else{
        newtxt[i] = text[i];
    }
}
for(i=0; i<integer; ++i) {
    print(newtxt[i])
}

const stdin = process.openStdin();
let n;
let i = 0;
const output = [];
stdin.addListener('data', text => {
  if (n) { i += 1; }
  if (!n) { n = parseInt(text.toString()) }

  if (i > 0) {
    const input = text.toString().trim();
    if (input.length > 10) {
      output.push(input.charAt(0) + (input.length - 2) + input.charAt(input.length - 1));
      console.log(input.charAt(0) + (input.length - 2) + input.charAt(input.length - 1));
    } else {
      output.push(input);
      console.log(input);
    }
  }

  if (i === n) {
    stdin.pause();
    // output.map(each => console.log(each));
    // console.log();
  }
});

var numberOfLines = readline();

print(numberOfLines);

for (var step = 0; step < numberOfLines; step++) {
    var line = readline();
    var length = line.length;

    if (length <= 10) {
        print(line);
    } else {
        print(`${line[0]}${length-2}${line[length-1]}`);
    }
}

/*
Sometimes some words like "localization" or "internationalization" are so long that writing them many times in one text is quite tiresome.

Let's consider a word too long, if its length is strictly more than 10 characters. All too long words should be replaced with a special abbreviation.

This abbreviation is made like this: we write down the first and the last letter of a word and between them we write the number of letters between the first and the last letters. That number is in decimal system and doesn't contain any leading zeroes.

Thus, "localization" will be spelt as "l10n", and "internationalization» will be spelt as "i18n".

You are suggested to automatize the process of changing the words with abbreviations. At that all too long words should be replaced by the abbreviation and the words that are not too long should not undergo any changes.

Input
The first line contains an integer n (1 ≤ n ≤ 100). Each of the following n lines contains one word. All the words consist of lowercase Latin letters and possess the lengths of from 1 to 100 characters.

Output
Print n lines. The i-th line should contain the result of replacing of the i-th word from the input data.

Examples
input
4
word
localization
internationalization
pneumonoultramicroscopicsilicovolcanoconiosis
output
word
l10n
i18n
p43s
*/

var input = readline().split(' ');
var largo = input.length-1;
var a = new Array();

for (var x = 0; x <= largo; x++){
	if(input[x].length-1 <=10){
		var fin = input[x].length-1;
		var primera = input[x][0];
		var medio = input[x].length-3;
		var ultima = input[x][fin];
		a.push(primera+medio+ultima);

	}else {
		if (isNaN(parseInt(input[x]))){
			a.push(input[x]);
		}
	}
	}

print(a);

/*var input = new Array("4","word","localization","internationalization","pneumonoultramicroscopicsilicovolcanoconiosis")
var largo = input.length-1;
var a = new Array();

for (var x = 0; x <= largo; x++){
	if(input[x].length-1 >=10){
		var fin = input[x].length-1;
		var primera = input[x][0];
		var medio = input[x].length-3;
		var ultima = input[x][fin];
		a.push(primera+medio+ultima);

	}else {
		if (isNaN(input[x])){
			a.push(input[x]);
		}
	}

}
document.write(a.join("</br>"));
*/

var lines = parseInt(readline())

while (lines--) {
  var word = readline()

  if (word.length > 10) {
    const prefix = word[0]
    const middle = word.length - 2
    const suffix = word[word.length - 1]

    print(prefix + middle + suffix)
  }

  print(word)
}

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

function readline() {
    return inputString[currentLine++];
}
// Make a Snippet for the code above this and then write your logic in main();

function main() {
    let input = readline();

    if (input.length > 1 && input.length < 11) {
        console.log(input);
    } else if (input.length > 11) {
        console.log(input.charAt(0) + (input.length-2).toString() + input.charAt(input.length-1));
    }

    input = readline();

    if (input.length > 1 && input.length < 11) {
        console.log(input);
    } else if (input.length > 11) {
        console.log(input.charAt(0) + (input.length-2).toString() + input.charAt(input.length-1));
    }

    input = readline();

    if (input.length > 1 && input.length < 11) {
        console.log(input);
    } else if (input.length > 11) {
        console.log(input.charAt(0) + (input.length-2).toString() + input.charAt(input.length-1));
    }

    input = readline();

    if (input.length > 1 && input.length < 11) {
        console.log(input);
    } else if (input.length > 11) {
        console.log(input.charAt(0) + (input.length-2).toString() + input.charAt(input.length-1));
    }

    if (input.length > 1 && input.length < 11) {
        console.log(input);
    } else if (input.length > 11) {
        console.log(input.charAt(0) + (input.length-2).toString() + input.charAt(input.length-1));
    }
}

var readline = require("readline");

var rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});
var n;
var words = [];
var expect = 'begin';
rl.on("line", function(line) {
    if( expect =="begin") {
        n = parseInt(line);
        expect = "word";
        case_counter = 1;
    }else if (expect == "word"){
        words[case_counter] = line.charAt(0)+ (line.length -2) + line.charAt(line.length -1);
        ++case_counter === n +1 ? rl.close() : 0;
        expect ="word";
    }
}).on("close",function(){

    for(var i=1;i <= words.length-1; i++){
        console.log(words[i]);
    }
    process.exit(0);
});

var p = Number(readline());
var g = new Array;
for(i=0;i<p;i++){
	g.push(readline());
}
var e = 0;
for(y = g[e];e<p;e++){
	print(y);
}

/*
Sometimes some words like "localization" or "internationalization" are so long that writing them many times in one text is quite tiresome.

Let's consider a word too long, if its length is strictly more than 10 characters. All too long words should be replaced with a special abbreviation.

This abbreviation is made like this: we write down the first and the last letter of a word and between them we write the number of letters between the first and the last letters. That number is in decimal system and doesn't contain any leading zeroes.

Thus, "localization" will be spelt as "l10n", and "internationalization» will be spelt as "i18n".

You are suggested to automatize the process of changing the words with abbreviations. At that all too long words should be replaced by the abbreviation and the words that are not too long should not undergo any changes.

Input
The first line contains an integer n (1 ≤ n ≤ 100). Each of the following n lines contains one word. All the words consist of lowercase Latin letters and possess the lengths of from 1 to 100 characters.

Output
Print n lines. The i-th line should contain the result of replacing of the i-th word from the input data.

Examples
input
4
word
localization
internationalization
pneumonoultramicroscopicsilicovolcanoconiosis
output
word
l10n
i18n
p43s
*/

var input = readline().split(' ');
var largo = input.length-1;
var a = new Array();

for (var x = 0; x <= largo; x++){
	if(input[x].length-1 >=10){
		var fin = input[x].length-1;
		var primera = input[x][0];
		var medio = input[x].length-3;
		var ultima = input[x][fin];
		a.push(primera+medio+ultima);

	}
}
print(a.join("
"))

/*
var input = new Array("4","word","localization","internationalization","pneumonoultramicroscopicsilicovolcanoconiosis")
var largo = input.length-1;
var a = new Array();

for (var x = 0; x <= largo; x++){
	if(input[x].length-1 >=10){
		var fin = input[x].length-1;
		var primera = input[x][0];
		var medio = input[x].length-3;
		var ultima = input[x][fin];
		a.push(primera+medio+ultima);

	}else {a.push(input[x]);
	}

}
document.write(a.join("
"))
*/

var i=0, n = parseInt(readline());
for(i ; i < n; i++){
  var s,
      e = readline(),
      len = e.length;
      if(len >10){s = e.charAt(0) + len + e.charAt(len-1);} else {s = e;}
  print(s);
}

var x=parseInt(readline());
var res;
while(x--){
    var a=readline();
    if(a.length <=10){
        print(a);
    }else{
        print(a[0]+a.length-2+a[a.length-1]);
    }
}

var inputs = readline();
var numberLines = isNaN(parseInt(inputs[0])) ? 0 : parseInt(inputs[0]);

// if(numberLines == 0){
//     print("ERROR");
// }
// if(numberLines > 100){
//     print("ERROR");
// }
// if(numberLines != inputs.length-1){
//     print("ERROR");
// }
var result = [];
for(var i = 1; i < inputs.length; i++){
    var tempS = "";
    if(inputs[i].length > 10){
        var number = inputs[i].length - 2;
        tempS = inputs[i].charAt(0) + number.toString() + inputs[i].charAt(inputs[i].length-1);
    }
    else{
        tempS = input[i];
    }
    result.push(tempS);
}
var temp = "";
for(var i = 0; i < result.length; i++){
    temp = temp + result[i] + "\n";
}
print(temp);

var word = readline();
(word < 10) ? print(word) : print("".concat(word.substring(0, 1), word.length - 2, word.substring(word.length - 1, word.length)));

const readline = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});

// multi line input
readline.on('line', line => {
  if(line.length > 1) {
    console.log(main(line))
  }

});

function main(strings) {
   return strings.length < 11 ?  strings : strings[0]+(strings.length-2)+strings[strings.length-1]
}

const stdin = process.openStdin();
let n;
let i = 0;
const output = [];
stdin.addListener('data', text => {
  if (n) { i += 1; }
  if (!n) { n = parseInt(text.toString()) }

  if (i > 0) {
    const input = text.toString().trim();
    if (input.length > 10) {
      output.push(input.charAt(0) + (input.length - 2) + input.charAt(input.length - 1));
    } else {
      output.push(input);
    }
  }

  if (i === n) {
    stdin.pause();
    output.map(each => console.log(each));
  }
});

let reading = null
let wordList = []

process.stdin.on('data', chunk => {
  let str = chunk.toString()
  if (reading === null) reading = parseInt(str)
  else {
    reading--
    wordList.push(str.replace(/[^a-zA-Z]/g, ''))
    if (reading === 0) wordList.forEach(word => console.log(abbreviate(word)))
  }
})

function abbreviate (str) {
  if (str.length <= 10) return str
  let strArray = str.split('')
  let first = strArray.shift()
  let last = strArray.pop()
  return first + strArray.length + last
}

const readline = require('readline')
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});

let first = true;
rl.on('line', line => {
    if (first === true) {
        first = false;
    } else {
        input = line;
        console.log(solution(line));
    }
});

function solution(word) {
    if (word.length < 10) {
        return word;
    }

    return word[0] + (word.length - 2) + word[word.length - 1];
}

var lines = readline().split('\n')

   print(lines)

  var myMap = function (array, callback) {
    var result = []
    for (var i = 0; i < array.length; i++) {
      result.push(callback.call(null, array[i]))
    }
    return result
  }

  var result = myMap(lines.slice(1), (line) => {
    var word = (line.length > 10) ? line[0] + (line.length - 2) + line[line.length - 1] : line
    print(word)
    return word
  })

 x=readline();

if(x.length>10)
{
    print(x[0]+(x.length-2)+x[x.length-1])
}
else
{
    print(x)
}

var n = parseInt(readline());
for (var i=0; i<n;i++){
    var palabra = readline();
    var talla = palabra.length;
    if(talla.length <=10){
        print (palabra);
    }
   else if(talla.length > 10){
        letrap = palabra[0];
        letrau = palabra[talla-1];
        letram = palara[talla-2];
        print (letrap+letram+letrau);
    }
    }

var n=readline();
for (var i=0; i<n; i++){
    str=readline();
    if (str.lengrh<=10) {print (str);}
    else {str=str[0]+(str.length-2)+str[str.length-1]; print (str);}
}

var y =[];
do {
     var x = readline();
    if (x!= undefined){
    y.push(x);}
   } while (x!==undefined & x!='');
y.forEach(function(a){
var l = a.length;
var out = a.charAt(0)+ (l-2) +a.charAt(l-1);
print(out);})

 /*
Own input stream*/
const readline = require('readline');
const rl = readline.createInterface({
    input: process.stdin,
    terminal: false
});

process.stdin.setEncoding('utf8');
let arr=[]
rl.on('line', (input) => {
    if(input!=='') arr.push(input)

}).on('close', () => {
    console.log(minfill(arr))
    process.exit(0);

});
function minfill(arr){

let n=arr[0];
for(let i=1;i<=n;i++){

    if(arr[i].length>10){
        console.log(arr[i][0]+String(arr[i].length-2)+arr[i][arr.length-1])
    }else{
        console.log(arr[i])
    }
}return ""
}

module.exports=(minfill)