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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     11fc <main+0xcc>
lea    -0x70(%rbp),%rsi
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
lea    -0x70(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0xa,%eax
jg     11a3 <main+0x73>
lea    -0x70(%rbp),%rsi
lea    0xe6f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11f7 <main+0xc7>
lea    -0x70(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0xa,%eax
jle    11f2 <main+0xc2>
movsbl -0x70(%rbp),%eax
mov    %eax,-0x78(%rbp)
lea    -0x70(%rbp),%rdi
call   1030 <strlen@plt>
sub    $0x2,%eax
mov    %eax,-0x74(%rbp)
lea    -0x70(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x78(%rbp),%esi
mov    -0x74(%rbp),%edx
sub    $0x1,%eax
cltq
movsbl -0x70(%rbp,%rax,1),%ecx
lea    0xe1f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11f7 <main+0xc7>
jmp    1154 <main+0x24>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x80,%rsp
lea    0xeaa(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
subl   $0x1,0xc(%rsp)
jae    117b <main+0x3b>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe81(%rip),%r14
lea    0x10(%rsp),%rbx
lea    0xe78(%rip),%r15
jmp    119c <main+0x5c>
call   1030 <puts@plt>
subl   $0x1,0xc(%rsp)
jb     1169 <main+0x29>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %rbx,%rdi
cmp    $0xa,%eax
jle    1190 <main+0x50>
call   1040 <strlen@plt>
cmp    $0xb,%eax
jl     1195 <main+0x55>
movsbl 0x10(%rsp),%r12d
mov    %rbx,%rdi
call   1040 <strlen@plt>
lea    -0x2(%rax),%ebp
mov    %rbx,%rdi
call   1040 <strlen@plt>
cltq
movsbl -0x1(%rax,%rbx,1),%ecx
mov    %r15,%rdi
mov    %r12d,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1195 <main+0x55>

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