#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ s;

/* Variables and functions */
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
int strlen(char *);
int main() {
  int len, N;
  char s[110];
  scanf("%d", &N);
  while (N--) {
    scanf("%s", s);
    len = strlen(s);
    if (len <= 10)
      printf("%s\n", s);
    else
      printf("%c%d%c\n", s[0], len - 2, s[len - 1]);
    memset(s, 0, sizeof(s));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xea7(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0xc(%rbp)
cmp    $0x0,%eax
je     11f1 <main+0xb1>
lea    -0x80(%rbp),%rsi
lea    0xe80(%rip),%rdi
mov    $0x0,%al
call   1060 <scanf@plt>
lea    -0x80(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jg     11b7 <main+0x77>
lea    -0x80(%rbp),%rsi
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11dc <main+0x9c>
movsbl -0x80(%rbp),%esi
mov    -0x8(%rbp),%edx
sub    $0x2,%edx
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
cltq
movsbl -0x80(%rbp,%rax,1),%ecx
lea    0xe35(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x80(%rbp),%rdi
xor    %esi,%esi
mov    $0x6e,%edx
call   1050 <memset@plt>
jmp    1164 <main+0x24>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x80,%rsp
lea    0xe9d(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
subl   $0x1,0xc(%rsp)
jae    1185 <main+0x35>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
lea    0xe77(%rip),%r14
lea    0x10(%rsp),%rbx
lea    0xe6e(%rip),%r15
jmp    11d0 <main+0x80>
nopw   0x0(%rax,%rax,1)
movsbl 0x10(%rsp),%esi
lea    -0x2(%rax),%edx
add    $0xffffffff,%eax
movsbl 0x10(%rsp,%rax,1),%ecx
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x6e,%edx
call   1060 <memset@plt>
subl   $0x1,0xc(%rsp)
jb     1176 <main+0x26>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
cmp    $0xa,%eax
jg     11a0 <main+0x50>
mov    %rbx,%rdi
call   1030 <puts@plt>
jmp    11ba <main+0x6a>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [4 x i8] c"%s\0A\00"
@.str.3 = [8 x i8] c"%c%d%c\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [110 x i8]
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
br label %6
6: ; preds = %33, %0
%7 = load i32, i32* %3
%8 = add nsw i32 %7, -1
store i32 %8, i32* %3
%9 = icmp ne i32 %7, 0
br i1 %9, label %10, label %36
10: ; preds = %6
%11 = getelementptr inbounds [110 x i8], [110 x i8]* %4, i64 0, i64 0
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %11)
%13 = getelementptr inbounds [110 x i8], [110 x i8]* %4, i64 0, i64 0
%14 = call i32 @strlen(i8* %13)
store i32 %14, i32* %2
%15 = load i32, i32* %2
%16 = icmp sle i32 %15, 10
br i1 %16, label %17, label %20
17: ; preds = %10
%18 = getelementptr inbounds [110 x i8], [110 x i8]* %4, i64 0, i64 0
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %18)
br label %33
20: ; preds = %10
%21 = getelementptr inbounds [110 x i8], [110 x i8]* %4, i64 0, i64 0
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = load i32, i32* %2
%25 = sub nsw i32 %24, 2
%26 = load i32, i32* %2
%27 = sub nsw i32 %26, 1
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [110 x i8], [110 x i8]* %4, i64 0, i64 %28
%30 = load i8, i8* %29
%31 = sext i8 %30 to i32
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i32 %23, i32 %25, i32 %31)
br label %33
33: ; preds = %20, %17
%34 = getelementptr inbounds [110 x i8], [110 x i8]* %4, i64 0, i64 0
%35 = call i32 @memset(i8* %34, i32 0, i32 110)
br label %6
36: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.3 = [8 x i8] c"%c%d%c\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [110 x i8]
%3 = bitcast i32* %1 to i8*
%4 = getelementptr inbounds [110 x i8], [110 x i8]* %2, i64 0, i64 0
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = add nsw i32 %6, -1
store i32 %7, i32* %1
%8 = icmp eq i32 %6, 0
br i1 %8, label %30, label %9
9: ; preds = %0, %25
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%11 = call i32 @strlen(i8* %4)
%12 = icmp slt i32 %11, 11
br i1 %12, label %13, label %15
13: ; preds = %9
%14 = call i32 @puts(i8* %4)
br label %25
15: ; preds = %9
%16 = load i8, i8* %4
%17 = sext i8 %16 to i32
%18 = add nsw i32 %11, -2
%19 = add nsw i32 %11, -1
%20 = zext i32 %19 to i64
%21 = getelementptr inbounds [110 x i8], [110 x i8]* %2, i64 0, i64 %20
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i32 %17, i32 %18, i32 %23)
br label %25
25: ; preds = %15, %13
%26 = call i32 @memset(i8* %4, i32 0, i32 110)
%27 = load i32, i32* %1
%28 = add nsw i32 %27, -1
store i32 %28, i32* %1
%29 = icmp eq i32 %27, 0
br i1 %29, label %30, label %9
30: ; preds = %25, %0
ret i32 0
}