#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 */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
int strlen(char *);
int main(void) {
  int i, n, nn;
  char a[126];
  scanf("%d", &n);
  for (nn = 1; nn <= n; nn++) {
    scanf("%s", a);
    i = strlen(a);
    if (i > 10)
      printf("%c%d%c\n", a[0], (i - 2), a[i - 1]);
    else
      printf("%s\n", a);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     11ed <main+0xbd>
lea    -0x90(%rbp),%rsi
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
lea    -0x90(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jle    11c5 <main+0x95>
movsbl -0x90(%rbp),%esi
mov    -0x8(%rbp),%edx
sub    $0x2,%edx
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
cltq
movsbl -0x90(%rbp,%rax,1),%ecx
ff
lea    0xe4d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11da <main+0xaa>
lea    -0x90(%rbp),%rsi
lea    0xe3b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11df <main+0xaf>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    115b <main+0x2b>
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x98,%rsp
lea    0xeac(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    11c7 <main+0x87>
lea    0xe95(%rip),%r14
lea    0x10(%rsp),%rbx
lea    0xe8c(%rip),%r15
xor    %ebp,%ebp
jmp    1191 <main+0x51>
xchg   %ax,%ax
mov    %rbx,%rdi
call   1030 <puts@plt>
add    $0x1,%ebp
cmp    0xc(%rsp),%ebp
jge    11c7 <main+0x87>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
cmp    $0xb,%eax
jl     1180 <main+0x40>
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>
jmp    1188 <main+0x48>
xor    %eax,%eax
add    $0x98,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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