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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%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     1234 <main+0x104>
movl   $0x0,-0x78(%rbp)
lea    -0x70(%rbp),%rsi
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
lea    -0x70(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x7c(%rbp)
cmpl   $0xa,-0x7c(%rbp)
jg     11bc <main+0x8c>
lea    -0x70(%rbp),%rsi
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    122f <main+0xff>
mov    -0x7c(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x84(%rbp)
mov    -0x70(%rbp),%al
mov    %al,-0x85(%rbp)
mov    -0x7c(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x70(%rbp,%rax,1),%al
mov    %al,-0x86(%rbp)
movsbl -0x85(%rbp),%esi
lea    0xe17(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x84(%rbp),%esi
lea    0xdfb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movsbl -0x86(%rbp),%esi
lea    0xdee(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xdde(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1154 <main+0x24>
xor    %eax,%eax
add    $0x90,%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),%r12
lea    0xe72(%rip),%r15
jmp    11c9 <main+0x89>
lea    -0x2(%rax),%ebp
movsbl 0x10(%rsp),%edi
add    $0xffffffff,%eax
movsbl 0x10(%rsp,%rax,1),%ebx
call   1030 <putchar@plt>
mov    %r15,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebx,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
subl   $0x1,0xc(%rsp)
jb     1169 <main+0x29>
mov    %r14,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    %r12,%rdi
call   1040 <strlen@plt>
cmp    $0xa,%eax
jg     1190 <main+0x50>
mov    %r14,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    11b8 <main+0x78>

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

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