#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() {
  int n, len, i;
  scanf("%d", &n);
  char strings[n][100];
  for (i = 0; i < n; i++) {
    scanf("%s", strings[i]);
  }
  for (i = 0; i < n; i++) {
    len = strlen(strings[i]);
    if (len <= 10) {
      printf("%s\n", strings[i]);
    } else {
      printf("%c%d%c\n", strings[i][0], len - 2, strings[i][len - 1]);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
xor    %eax,%eax
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
imul   $0x64,%rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x28(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11b6 <main+0x86>
mov    -0x28(%rbp),%rsi
movslq -0x10(%rbp),%rax
imul   $0x64,%rax,%rax
add    %rax,%rsi
lea    0xe62(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    117f <main+0x4f>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1260 <main+0x130>
mov    -0x28(%rbp),%rdi
movslq -0x10(%rbp),%rax
imul   $0x64,%rax,%rax
add    %rax,%rdi
call   1030 <strlen@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jg     120c <main+0xdc>
mov    -0x28(%rbp),%rsi
movslq -0x10(%rbp),%rax
imul   $0x64,%rax,%rax
add    %rax,%rsi
lea    0xe06(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    124d <main+0x11d>
mov    -0x28(%rbp),%rax
movslq -0x10(%rbp),%rcx
imul   $0x64,%rcx,%rdx
mov    %rax,%rcx
add    %rdx,%rcx
movsbl (%rcx),%esi
mov    -0xc(%rbp),%edx
sub    $0x2,%edx
movslq -0x10(%rbp),%rcx
imul   $0x64,%rcx,%rcx
add    %rcx,%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%ecx
lea    0xdc4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1252 <main+0x122>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11bd <main+0x8d>
movl   $0x0,-0x4(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xeab(%rip),%rdi
lea    -0x2c(%rbp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    %rsp,%r12
mov    -0x2c(%rbp),%eax
mov    %rsp,%r15
imul   $0x64,%rax,%rax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r15
mov    %r15,%rsp
cmpl   $0x0,-0x2c(%rbp)
jle    1211 <main+0xd1>
lea    0xe77(%rip),%r14
mov    %r15,%r13
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
add    $0x1,%rbx
movslq -0x2c(%rbp),%rax
add    $0x64,%r13
cmp    %rax,%rbx
jl     11a0 <main+0x60>
test   %eax,%eax
jle    1211 <main+0xd1>
lea    0xe3d(%rip),%r14
xor    %ebx,%ebx
jmp    11fa <main+0xba>
nopl   (%rax)
movsbl (%r15),%esi
lea    -0x2(%rax),%edx
add    $0xffffffff,%eax
movsbl (%r15,%rax,1),%ecx
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbx
movslq -0x2c(%rbp),%rax
add    $0x64,%r15
cmp    %rax,%rbx
jge    1211 <main+0xd1>
mov    %r15,%rdi
call   1040 <strlen@plt>
cmp    $0xa,%eax
jg     11d0 <main+0x90>
mov    %r15,%rdi
call   1030 <puts@plt>
jmp    11e9 <main+0xa9>
mov    %r12,%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
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 = [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 i32
%5 = alloca i8*
%6 = alloca i64
store i32 0, i32* %1
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%8 = load i32, i32* %2
%9 = zext i32 %8 to i64
%10 = call i8* @llvm.stacksave()
store i8* %10, i8** %5
%11 = alloca [100 x i8], i64 %9
store i64 %9, i64* %6
store i32 0, i32* %4
br label %12
12: ; preds = %22, %0
%13 = load i32, i32* %4
%14 = load i32, i32* %2
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %25
16: ; preds = %12
%17 = load i32, i32* %4
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i64 %18
%20 = getelementptr inbounds [100 x i8], [100 x i8]* %19, i64 0, i64 0
%21 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %20)
br label %22
22: ; preds = %16
%23 = load i32, i32* %4
%24 = add nsw i32 %23, 1
store i32 %24, i32* %4
br label %12
25: ; preds = %12
store i32 0, i32* %4
br label %26
26: ; preds = %64, %25
%27 = load i32, i32* %4
%28 = load i32, i32* %2
%29 = icmp slt i32 %27, %28
br i1 %29, label %30, label %67
30: ; preds = %26
%31 = load i32, i32* %4
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i64 %32
%34 = getelementptr inbounds [100 x i8], [100 x i8]* %33, i64 0, i64 0
%35 = call i32 @strlen(i8* %34)
store i32 %35, i32* %3
%36 = load i32, i32* %3
%37 = icmp sle i32 %36, 10
br i1 %37, label %38, label %44
38: ; preds = %30
%39 = load i32, i32* %4
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i64 %40
%42 = getelementptr inbounds [100 x i8], [100 x i8]* %41, i64 0, i64 0
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %42)
br label %63
44: ; preds = %30
%45 = load i32, i32* %4
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i64 %46
%48 = getelementptr inbounds [100 x i8], [100 x i8]* %47, i64 0, i64 0
%49 = load i8, i8* %48
%50 = sext i8 %49 to i32
%51 = load i32, i32* %3
%52 = sub nsw i32 %51, 2
%53 = load i32, i32* %4
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i64 %54
%56 = load i32, i32* %3
%57 = sub nsw i32 %56, 1
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds [100 x i8], [100 x i8]* %55, i64 0, i64 %58
%60 = load i8, i8* %59
%61 = sext i8 %60 to i32
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i32 %50, i32 %52, i32 %61)
br label %63
63: ; preds = %44, %38
br label %64
64: ; preds = %63
%65 = load i32, i32* %4
%66 = add nsw i32 %65, 1
store i32 %66, i32* %4
br label %26
67: ; preds = %26
store i32 0, i32* %1
%68 = load i8*, i8** %5
%69 = load i32, i32* %1
ret i32 %69
}

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 = bitcast i32* %1 to i8*
%3 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = zext i32 %4 to i64
%6 = call i8* @llvm.stacksave()
%7 = alloca [100 x i8], i64 %5
%8 = load i32, i32* %1
%9 = icmp sgt i32 %8, 0
br i1 %9, label %12, label %42
10: ; preds = %12
%11 = icmp sgt i32 %17, 0
br i1 %11, label %20, label %42
12: ; preds = %0, %12
%13 = phi i64 [ %16, %12 ], [ 0, %0 ]
%14 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 %13, i64 0
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %14)
%16 = add nuw nsw i64 %13, 1
%17 = load i32, i32* %1
%18 = sext i32 %17 to i64
%19 = icmp slt i64 %16, %18
br i1 %19, label %12, label %10
20: ; preds = %10, %37
%21 = phi i64 [ %38, %37 ], [ 0, %10 ]
%22 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 %21, i64 0
%23 = call i32 @strlen(i8* %22)
%24 = icmp slt i32 %23, 11
br i1 %24, label %25, label %27
25: ; preds = %20
%26 = call i32 @puts(i8* %22)
br label %37
27: ; preds = %20
%28 = load i8, i8* %22
%29 = sext i8 %28 to i32
%30 = add nsw i32 %23, -2
%31 = add nsw i32 %23, -1
%32 = zext i32 %31 to i64
%33 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 %21, i64 %32
%34 = load i8, i8* %33
%35 = sext i8 %34 to i32
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i32 %29, i32 %30, i32 %35)
br label %37
37: ; preds = %25, %27
%38 = add nuw nsw i64 %21, 1
%39 = load i32, i32* %1
%40 = sext i32 %39 to i64
%41 = icmp slt i64 %38, %40
br i1 %41, label %20, label %42
42: ; preds = %37, %0, %10
ret i32 0
}