package main

import (
	"fmt"
)

func main() {
	var a string
	var inp int
	fmt.Scanf("%d\n", &inp)
	for i := inp; i > 0; {
		fmt.Scanf("%s\n", &a)
		if len(a) <= 10 {
			fmt.Printf("%s\n", a)
		} else {
			fmt.Printf("%s%d%s\n", (string)(a[0]), (len(a) - 2), (string)(a[len(a)-1]))
		}
		i--
	}
}

package main

import ("fmt"
        "strconv"
        )
func main() {
	var input int
	fmt.Scanf("%d\n",&input)

	stringArr := make([]string, input)
	for i := 0; i < input; i++ {
		fmt.Scanf("%s\n",&stringArr[i])
    length := len(stringArr[i])
    if  length > 10 {
      fmt.Println(string(stringArr[i][0]) + strconv.Itoa(length -2) + string(stringArr[i][length -1]))
    } else {
      fmt.Println(stringArr[i])
    }
	}

}

package main

import . "fmt"

func get_string( s string ) string {
    n := len(s)
    if n > 10 {
        return Sprintf("%c%s%c", s[0], Sprintf("%d", n - 2), s[n - 1])
    }
    return s
}

func main() {
    var n int
    Scanf("%d\n", &n)
    for i := 0; i < n; i ++ {
        var s string
        Scanf("%s\n", &s)
        Printf("%s\n", get_string(s))
    }
}

package main

import "fmt"

func get_string( s string ) string {
    n := len(s)
    if n > 10 {
        return fmt.Sprintf("%c%s%c", s[0], fmt.Sprintf("%d", n - 2), s[n - 1])
    }
    return s
}

func main() {
    var n int
    fmt.Scanf("%d\n", &n)
    for i := 0; i < n; i ++ {
        var s string
        fmt.Scanf("%s\n", &s)
        fmt.Printf("%s\n", get_string(s))
    }
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }

func main() {
	defer writer.Flush()
	var n int
	scanf("%d\n", &n)
	for i := 0; i < n; i += 1 {
		var s string
		scanf("%s\n", &s)
		length := len(s)
		if length <= 10 {
			printf("%s\n", s)
		} else {
			printf("%c%d%c\n", s[0], length - 2, s[length - 1])
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var inputReader *bufio.Reader
var input string
var err error

func main() {

	var totalCount int
	fmt.Scanf("%d", &totalCount)

	var input string
	scanner := bufio.NewScanner(os.Stdin)

	for scanner.Scan() {
		input = scanner.Text()
		length := len(input)

		if length > 10 {
			fmt.Println(string(input[0]) + strconv.Itoa(length-2) + string(input[length-1]))
		} else {
			fmt.Println(input)
		}

		totalCount--
		if totalCount < 0 {
			break
		}
	}
}

package main

import (
	"fmt"
)

func main() {
	var n int
	var str[100] string

	fmt.Scanf("%d\n", &n)

	for i := 0; i < n; i++{
		fmt.Scanf("%s\n", &str[i])
	}

	for i := 0; i < n; i++ {
		if len(str[i]) > 10{
			fmt.Printf("%c%d%c\n",str[i][0], len(str[i]) - 2, str[i][len(str[i]) - 1])
		} else {
			fmt.Printf("%s\n", str[i])
		}
	}

}

// olymp
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scanf("%d\n", &n)
	for i := 0; i < n; i++ {
		var s string
		fmt.Scanf("%s\n", &s)
		if len(s) > 10 {
			fmt.Printf("%c%d%c\n", s[0], len(s)-2, s[len(s)-1])
		} else {
			fmt.Println(s)
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
)

func main() {
	var n uint8
	var scanner *bufio.Scanner
	var answers []string

	scanner = bufio.NewScanner(os.Stdin)
	scanner.Scan()
	fmt.Sscanf(scanner.Text(), "%d", &n)

	// fmt.Println(n)

	answers = make([]string, n)
	for i := uint8(0); i < n; i++ {
		scanner.Scan()
		answers[i] = solution(strings.TrimSpace(scanner.Text()))
	}

	for i := uint8(0); i < n; i++ {
		fmt.Println(answers[i])
	}
}

func solution(text string) string {
	var num uint8
	var numInStringFormat string
	if len(text) > 10 {
		num = uint8(len(text)) - 2
		numInStringFormat = itoa(num)
		return string(text[0]) + numInStringFormat + string(text[len(text)-1])
	}
	return text
}

func itoa(num uint8) string {
	var r uint8
	var nums []byte
	var count uint8
	var tenFold uint8
	var tmp []byte

	nums = []byte{48, 49, 50, 51, 52, 53, 54, 55, 56, 57}
	count = 1
	tenFold = 1

	for {
		if (num / (tenFold * 10)) < 1 {
			break
		} else {
			tenFold *= 10
			count++
		}
	}

	// fmt.Println(tenFold, count)

	tmp = make([]byte, count)

	for count > 0 {
		r = num % 10
		tmp[count-1] = nums[r]
		num = num - r
		num = num / 10
		count--
	}

	return string(tmp)
}

package main

import (
  "fmt"
)

func main(){
  var s string
  var n int
  fmt.Scanf("%d\n", &n)

  for j := 0; j<n; j++ {
    fmt.Scanf("%s\n", &s)
    i := len(s)
    if i>10 {
      fmt.Printf("%c%d%c\n", s[0], i-2, s[i-1])
    }else{
      fmt.Println(s)
    }
  }
}

package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scanf("%d\n", &n)

	for i := 0; i < n; i++ {
		var str string
		fmt.Scanf("%s\n", &str)
		var strLen int = len(str)

		if strLen > 10 {
			fmt.Printf("%s%d%s\n", string(str[0]), strLen-2, string(str[len(str)-1]))
		} else {
			fmt.Println(str)
		}
	}
}

package main
import "fmt"
func main() {
    var n int
    var s string
    fmt.Scanf("%d\n", &n)
    for i := 0; i < n; i++ {
        fmt.Scanf("%s\n", &s)
        if len(s) <= 10 {
            fmt.Printf("%s\n", s)
            continue
        }
        fmt.Printf("%c%d%c\n", s[0], len(s) - 2, s[len(s)-1])
    }
}

package main

import (
	"bytes"
	"fmt"
	"strconv"
	"strings"
)

func main() {
	var n int
	var arr []string
	fmt.Scanf("%d", &n)
	arr = make([]string, n)
	for i := 0; i < n; i++ {
		var s string
		fmt.Scan(&s)
		if len(s) > 10 {
			var buf bytes.Buffer
			buf.WriteByte(s[0])
			ins := len(s[1 : len(s)-1])
			buf.WriteString(strconv.Itoa(ins))
			buf.WriteByte(s[len(s)-1])
			arr = append(arr, buf.String())
		} else {
			arr = append(arr, s)
		}
	}
	fmt.Println(strings.Join(arr, "\n"))
}

package main

import "fmt"

func main() {
	var left int
	fmt.Scanf("%d\n", &left)

	for ; left > 0; left-- {
		var w string
		fmt.Scanf("%s\n", &w)
		fmt.Println(abbr(w))
	}
}

func abbr(w string) string {
	if len(w) <= 10 {
		return w
	}

	f := w[0]
	l := w[len(w)-1]

	return fmt.Sprintf("%c%d%c", f, len(w)-2, l)
}

package main

import (
	"fmt"
)

func main() {
	var n int
	var str string
	fmt.Scanln(&n)
	for n > 0 {
		n--
		fmt.Scanln(&str)
		l := len(str)
		if l <= 10 {
			fmt.Println(str)
		} else {
			fmt.Printf("%c%d%c\n", str[0], l-2, str[l-1])
		}
	}
}

package main

import (
	"fmt"
	"strconv"
)

func main() {
	var n string
	_, _ = fmt.Scanln(&n)
	nr, _ := strconv.Atoi(n)

	for i := 0; i < nr; i++ {
		var word string
		_, _ = fmt.Scan(&word)

		if len(word) <= 10 {
			fmt.Println(word)
		} else {
			f := string(word[0])
			l := string(word[len(word)-1])
			s := len(word) - 2
			res := fmt.Sprintf("%s%d%s", f, s, l)
			fmt.Println(res)
		}
	}

}

package main

import "fmt"

func main() {
	var n byte
	fmt.Scanf("%d", &n)
	var arr = make([]string, n)

	for i := byte(0); i < n; i++ {
		fmt.Scan(&arr[i])
	}

	for _, v := range arr {
		if len(v) > 10 {
			fmt.Printf("%s%d%s\n", v[0:1], len(v)-2, v[len(v)-1:len(v)])
		} else {
			fmt.Println(v)
		}
	}
}

package main

import "fmt"

const (
	MAX_CHARS = 10
)

func main() {
	var n int
	fmt.Scanf("%d", &n)
	words := make([]string, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&words[i])
	}

	for i, word := range words {
		length := len(word)
		if length > MAX_CHARS {
			fmt.Printf(fmt.Sprintf("%s%d%s", word[:1], length-2, word[length-1:]))
		} else {
			fmt.Printf(word)
		}

		if i != len(words)-1 {
			fmt.Println("")
		}
	}
}

package main

// https://codeforces.com/problemset/problem/71/A

/*
* комментарии к решению
* В виду низких требований к входным данным == длина строк <= 100
* задача решается в лоб через строки:
* Читаем строку -> если длина больше 10, то
* в ответ кидаем
* 1) первый символ
* 2) кол-во символом между первой и последней буквой
* 3) последний символ
* 4) \n
* Не забываем обрезать последний лишний
 */

import (
	"bytes"
	"fmt"
	"io/ioutil"
	"os"
)

const maxLen = 10

func taskSolution(a [][]byte) (ans string) {
	for i := 0; i < len(a); i += 1 {
		line := bytes.TrimSpace(a[i])
		if len(line) > maxLen {
			ans = fmt.Sprintf("%s%c%d%c\n", ans, line[0], len(line)-2, line[len(line)-1])
		} else {
			ans = fmt.Sprintf("%s%s\n", ans, line)
		}
	}
	return ans[:len(ans)-1]
}

func main() {
	var n int
	if _, err := fmt.Scan(&n); err != nil {
		panic(err)
	}

	inRaw, err := ioutil.ReadAll(os.Stdin)
	if err != nil {
		panic(err)
	}
	inRawArr := bytes.Split(bytes.TrimSpace(inRaw), []byte("\n"))

	fmt.Println(taskSolution(inRawArr))
}

package main

import "fmt"

func abbreviate(s string) string {
    var n int
    n = len(s);
    if n > 10 {
        return fmt.Sprintf("%c%d%c",s[0],n-2,s[n-1]);
    } else {
        return s;
    }
}

func main() {
    var n int
    fmt.Scanf("%d\n", &n);
    for i := 1; i <= n; i++ {
        var s string;
        fmt.Scanf("%s\n", &s);
        fmt.Println(abbreviate(s));
    }
}

package main

import (
  "fmt"
  "os"
  "bufio"
  "log"
  //"strconv"
)
//similiar functions on internet.
func fastGetInt(b[]byte) int{
  neg := false
	if b[0] == '-' {
		neg = true
		b = b[1:]
	}
	n := 0
	for _, v := range b {
		n = n*10 + int(v-'0')
	}
	if neg {
		return -n
	}
	return n
}

func fastGetStr(b byte) string{
  t := ""
	if b >= 'A'&& b<='Z' {
		t = string('Z'-('Z'-b))
  }
  if b >= 'a'&& b<='z' {
		t = string('z'-('z'-b))
	}

	return t
}

func solveFromFile() {
    var nu int
    file, err := os.Open(os.Args[1])
    if err != nil {
      log.Fatalf("failed opening file: %s", err)
    }
    scanner := bufio.NewScanner(file)
    scanner.Scan()
    nu= fastGetInt(scanner.Bytes())
    for x := 0; x < nu; x++ {
      scanner.Scan()
      solution(scanner.Bytes())
    }
    defer file.Close()

}

//========== Implement Algorithm =======================
func solution(num []byte){
  if len(num)>10 {
    //fmt.Println(num)
    first:= num[0]
    mid:= (len(num)-2)
    last := (num[len(num)-1])
    fmt.Printf(fastGetStr(first))
    fmt.Printf("%d",mid)
    fmt.Printf(fastGetStr(last))
    fmt.Println()

    //fmt.Println(first+mid+last)
    //fmt.Sprintf("%s%s%s",num[0],len(num)-2,num[len(num)-1])
   // fmt.Println(string(num[0])+string(len(num)-2)+string(num[len(num)-1]))
  }else{
    fmt.Println(string(num))
  }
}

func main() {

//================== Variables used ====================
  var num int
//======================================================

  if len(os.Args) >=2{
//============== Get return value from File ============
    solveFromFile()

  }else{
//============== Get return value from STDIN ===========
    scanner := bufio.NewScanner(os.Stdin)

    scanner.Scan()
    num = fastGetInt(scanner.Bytes())
    for x := 0; x < num; x++ {
      scanner.Scan()
      solution(scanner.Bytes())
    }
  }

//================== OUTPUT ============================
  //fmt.Println(ret)
}

package main

import ("fmt")

func main() {
	var l int
	fmt.Scanf("%d\n", &l)
	var words []string
	for l > 0 {
		var s string
		fmt.Scanf("%s\n", &s)
		if len(s) > 10 {
			words = append(words, fmt.Sprintf("%c%d%c", s[0], len(s) - 2, s[len(s) - 1]))
		} else { words = append(words, s) }
		l = l - 1
	}
	for _, word := range(words) {
		fmt.Println(word)
	}
}

package main

import "fmt"

func main() {
	var i int
	_, err := fmt.Scanf("%d\n", &i)
	if err != nil {
		panic(err)
	}

	for cpt := 0; cpt < i; cpt++ {
		var word string
		_, err = fmt.Scanf("%s\n", &word)

		if err != nil {
			panic(err)
		}

		if len(word) > 10 {
			d := len(word) - 2
			fmt.Printf("%v%d%v\n", string(word[0]), d, string(word[len(word)-1]))

		} else {
			fmt.Println(word)
		}
	}

}

package main

import (
    "fmt"
)

func main() {
	var num int
    var words[] string
   	fmt.Scanln(&num)
    for i := 0; i < num; i++ {
        var word string
        fmt.Scanln(&word)
        words = append(words, word)
    }
    for _, str := range(words){
        if len(str) > 10{
            fmt.Printf("%s%d%s\n", string(str[0]), len(str)-2, string(str[len(str)-1]))
        }else{
            fmt.Println(str)
        }
    }
}

package main

import "fmt"

func main() {
	var (
		n   int
		msg string
	)
	_, _ = fmt.Scanf("%d\n", &n)

	for i := 0; i < n; i++ {
		_, _ = fmt.Scanln(&msg)
		printAbbr(msg)
	}
}

func printAbbr(msg string) {
	if len(msg) > 10 {
		fmt.Printf("%c%d%c\n", msg[0], len(msg)-2, msg[len(msg)-1])
	} else {
		fmt.Println(msg)
	}
}

package main

import (
  "fmt"
)

func main() {
  var lines int
  fmt.Scan(&lines)

  for i := 0; i < lines; i++ {
    var word string
    fmt.Scan(&word)
    if len(word) > 10{
      fmt.Printf("%s%d%s\n", string(word[0]), len(word)-2, string(word[len(word)-1]))
      continue
    }
    fmt.Print(word+"\n")
  }
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	n := 0
	scanner := bufio.NewScanner(os.Stdin)
	for scanner.Scan() {
		if n == 0 {
			n, _ = strconv.Atoi(scanner.Text())
		} else {
			fmt.Println(abbreviate(scanner.Text()))
			n--
			if n == 0 {
				return
			}
		}
	}
}

func abbreviate(word string) string {
	count := len(word)
	if count <= 10 {
		return word
	}
	return fmt.Sprint(string(word[0]), count-2, string(word[count-1]))
}

package main

import (
  "fmt"
  "os"
  "bufio"
)

func main() {
  var lines int
  inpt := bufio.NewReader(os.Stdin)
  fmt.Fscan(inpt, &lines)

  for i := 0; i < lines; i++ {
    var word string
    fmt.Fscan(inpt, &word)

    if len(word) > 10{
      fmt.Printf("%s%d%s\n", string(word[0]), len(word)-2, string(word[len(word)-1]))
    } else {
      fmt.Print(word+"\n")
    }
  }
}

package main

import (
  "bufio"
  "fmt"
  "os"
)

func main() {
  cin := bufio.NewReader(os.Stdin)
  var n int
  fmt.Fscan(cin, &n)
//	cin.ReadString('\n')
  var s string
  for i := 0; i < n; i++ {
    fmt.Fscan(cin, &s)
//		cin.ReadString('\n')
    if len(s) <= 10 {
      fmt.Printf("%s\n", s)
    } else {
      fmt.Printf("%c%d%c\n", s[0], len(s)-2, s[len(s)-1])
    }
  }
}

package main

import "fmt"

func main() {
  var lines int
  fmt.Scan(&lines)

  var words []string

  for i := 0; i < lines; i++ {
    var word string
    fmt.Scan(&word)
    if len(word) > 10{
      word = fmt.Sprintf("%s%d%s", string(word[0]), len(word)-2, string(word[len(word)-1]))
    }
    words = append(words, word)
  }
  for _, w := range words {
    fmt.Println(w)
  }
}

package main

import (
	"fmt"
	"time"
)

func toString(n int) string {
	result := ""
	for n != 0 {
		result = string(n % 10 + 48) + result
		n /= 10
	}
	return result
}

func process(word string, index int, answer []string) {
	length := len(word)
	if length <= 10 {
		// fmt.Println(word)
		answer[index] = word
	} else {
		// fmt.Println(string(word[0]) + toString(length - 2) + string(word[length - 1]))
		answer[index] = string(word[0]) + toString(length - 2) + string(word[length - 1])
	}
}

func main() {
	// fmt.Println("Hello World")
	var n int
	fmt.Scanln(&n)
	answer := make([]string, n)
	for i := 0; i < n; i++ {
		var word string
		fmt.Scanln(&word)
		go process(word, i, answer)
	}
	time.Sleep(time.Millisecond * 500)
	for _, value := range answer {
		fmt.Println(value)
	}
}

package main

import (
	"fmt"
)

func main() {
	var count int
	fmt.Scanf("%d\n", &count)
	var words = make([]string,count)

	for i := 0; i < count; i++ {
		fmt.Scanf("%s\n",&words[i])
	}
	for it :=0; it < count;it++{
		LongWords(&words[it])
	}

}

func LongWords(str *string){
	if len(*str) <= 10{
		fmt.Println(*str)
		return
	}
	l := len(*str) - 1
	fmt.Printf("%c%d%c\n",(*str)[0],l-1,(*str)[l])
}

package main

import "fmt"

func main() {
  var n, l int
  var a string

  fmt.Scanln(&n)

  for i := 0; i < n; i++ {
    fmt.Scanln(&a)
    l = len(a)
    if l > 10 {
      fmt.Println(fmt.Sprintf("%s%d%s", string(a[0]), l-2, string(a[l-1])))
    } else {
      fmt.Println(a)
    }
  }
}

package main

import "fmt"

func toString(n int) string {
	result := ""
	for n != 0 {
		result = string(n % 10 + 48) + result
		n /= 10
	}
	return result
}

func process() {
	var word string
	fmt.Scanln(&word)
	length := len(word)
	if length <= 10 {
		fmt.Println(word)
	} else {
		fmt.Println(string(word[0]) + toString(length - 2) + string(word[length - 1]))
	}
}

func main() {
	// fmt.Println("Hello World")
	var n int
	fmt.Scanln(&n)
	for i := 0; i < n; i++ {
		process()
	}
}

package main

import (
	"fmt"
	// "lib"
	// "math"
	// "reflect"
	// "strings"
	// "time"
	// "sync"
	"strconv"
)

func process(word string, ID int, answer []string) {
	length := len(word)
	if (length <= 10) {
		answer[ID] = word
	} else {
		answer[ID] = string(word[0]) + strconv.Itoa(length - 2) + string(word[length - 1])
	}
}

func main() {
	// fmt.Println("My OS Type: " + lib.GetOSType()))
	var n int
	fmt.Scanln(&n)
	answer := make([]string, n)
	for ID := 0; ID < n; ID++ {
		var word string
		fmt.Scanln(&word)
		process(word, ID, answer)
	}
	for _, value := range answer {
		fmt.Println(value)
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {

	words := make([]string, 0)
	scanner := bufio.NewScanner(os.Stdin)

	scanner.Scan()
	n, _:= strconv.Atoi(scanner.Text())

	if n > 0 {
		for i := 0; i < n; i++ {
			scanner.Scan()
			word := scanner.Text()
			words = append(words, word)
		}

		for j := range words {
			var wl = len(words[j])
			if wl > 10 {
				chunk0 := words[j][:1]
				chunk1 := words[j][1:wl - 1]
				chunk2 := words[j][wl-1:]

				fmt.Println(chunk0 + strconv.Itoa(len(chunk1)) + chunk2)
			} else {
				fmt.Println(words[j])
			}
		}
	}
}

package main

import (
	"fmt"
)

func main() {
	var n int
	var word string

	fmt.Scanf("%d\n", &n)

	for i := 0; i < n; i++ {
		fmt.Scanf("%s\n", &word)
		if len(word) > 10 {
			fmt.Printf("%c%d%c\n", word[0], len(word)-2, word[len(word)-1])
		} else {
			fmt.Println(word)
		}
	}
}

package main

import ("fmt")

func main() {
    var i,n int
	var s string
	fmt.Scan(&n)
	for i=0;i<n;i++ {
	    fmt.Scan(&s)
		if(len(s)>10) {
		    fmt.Printf("%c%d%c\n",s[0],len(s)-2,s[len(s)-1])
		} else {
		    fmt.Println(s)
		}
	}
}

package main

import (
	"bufio"
	. "fmt"
	"io"
	"os"
	"strconv"
)

func GO(_r io.Reader, _w io.Writer) {

	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()

	var T int
	var s string
	for Fscan(in, &T); T > 0; T-- {

		Fscan(in, &s)
		if len(s) <= 10 {
			Fprintln(out, s)
		} else {
			st := strconv.Itoa(len(s)-2)
			Fprintln(out, s[0:1]+st+s[len(s)-1:])
		}

	}

}

func main() {
	GO(os.Stdin, os.Stdout)
}

package main

import (
	"fmt"
	"strconv"
)

func main() {
	n := 0
	fmt.Scanln(&n)

	words := make([]string, n)

	for i := 0; i < n; i++ {
		fmt.Scanln(&words[i])
	}
	for i := 0; i < n; i++ {
		s := words[i]

		if len(s) > 10 {
			s = string(s[0]) + strconv.Itoa(len(s)-2) + string(s[len(s)-1])
		}
		fmt.Println(s)
	}
}

package main

import (
	"fmt"
	"os"
)

func main() {
	inputStrings := make([]string, 0)
	var totalStrings int
	if _, err := fmt.Scan(&totalStrings); err != nil {
		fmt.Println(err)
		os.Exit(1)
	}

	for i := 0; i < totalStrings; i++ {
		var inpString string
		if _, err := fmt.Scan(&inpString); err != nil {
			fmt.Println(err)
			os.Exit(1)
		}
		inputStrings = append(inputStrings, inpString)
	}

	for _, inputString := range inputStrings {
		if len(inputString) > 10 { // Word is too long
			fmt.Printf("%v%v%v\n", inputString[:1], len(inputString)-2, inputString[len(inputString)-1:])
		} else {
			fmt.Println(inputString)
		}
	}
}

package main

import (
	"fmt"
	"strconv"
)

func CreateResult(word string) string {
	var representation string
	if len(word) <= 10 {
		representation = word
	} else {
		representation = word[0:1] + strconv.Itoa(len(word[1:len(word)-1])) + word[len(word)-1:]
	}
	return representation
}

func main() {
	var n int
	fmt.Scanf("%d", &n)
	var words [100]string
	for i := 0; i < n; i++ {
		fmt.Scan(&words[i])
	}
	for i := 0; i < n; i++ {
		fmt.Println(CreateResult(words[i]))
	}
}

package main

import (
	"fmt"
	"strconv"
)

func main() {
	var index int
	fmt.Scan(&index)

	for i := index; i > 0; i-- {
		var text string
		fmt.Scan(&text)
		if len(text) > 10 {
			w_count := strconv.Itoa(len(text) - 2)
			shorttxt := string(text[0]) + w_count + string(text[len(text)-1])
			fmt.Println(shorttxt)
		} else {
			fmt.Println(text)
		}
	}
}

package main

import (
	"fmt"
)

const LONG_WORD_LEN int = 10

func main() {
        var n uint32
        fmt.Scanf("%d", &n)

        for n != 0 {
		var str string
		fmt.Scan(&str)

		length := len(str)
                if (length <= LONG_WORD_LEN) {
                        fmt.Printf("%s\n", str)
                } else {
                        fmt.Printf("%c%d%c\n", str[0], length - 2, str[length-1])
                }

                n--
        }
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

const lineDelim = '\r'

func TrimCRLF(s string) string {
	return strings.Trim(s, "\r \n")
}

func readInts(r *bufio.Reader) []int64 {
	str, _ := r.ReadString(lineDelim)
	str = TrimCRLF(str)
	numbersRaw := strings.Split(str, " ")
	var numbers []int64
	for _, i := range numbersRaw {
		n, _ := strconv.Atoi(i)
		numbers = append(numbers, int64(n))
	}

	return numbers
}

func readInt(r *bufio.Reader) int64 {
	str, _ := r.ReadString(lineDelim)
	str = TrimCRLF(str)
	n, _ := strconv.Atoi(str)

	return int64(n)
}

func readString(r *bufio.Reader) string {
	str, _ := r.ReadString(lineDelim)
	str = TrimCRLF(str)

	return str
}

func abbreviate(s string) string {
	return fmt.Sprintf("%s%d%s", string(s[0]), len(s)-2, string(s[len(s)-1]))
}

func main() {
	reader := bufio.NewReader(os.Stdin)
	n := readInt(reader)
	for i := 0; i < int(n); i++ {
		str := readString(reader)
		if len(str) > 10 {
			fmt.Println(abbreviate(str))
		} else {
			fmt.Println(str)
		}
	}

}

package main

import (
	"fmt"
)

func main() {
	var number uint8
	_, _ = fmt.Scanln(&number)

	for number > 0 {
		var iString string
		_, _ = fmt.Scanln(&iString)
		if len(iString) <= 10 {
			fmt.Printf("%s\n",iString)
		} else {
			length := len(iString)
			fmt.Printf("%c%d%c\n", iString[0], length-2, iString[length-1])
		}
		number--
	}
}

package main

import (
	"fmt"
)

func main() {
	var n int
	var input string
	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		fmt.Scan(&input)
		if len(input) <= 10 {
			fmt.Print(input)
		} else {
			fmt.Print(string(input[0]))
			fmt.Print(len(input) - 2)
			fmt.Print(string(input[len(input)-1]))
		}
		if i != n-1 {
			fmt.Printf("\n")
		}
	}
}

package main

import "fmt"

func main() {
	var (
		n int
		s [101]string
	)
    fmt.Scan(&n)
	for i := 1; i <= n; i++ {
		fmt.Scan(&s[i])
		len_s := len(s[i])
		if len_s > 10 {
			fmt.Printf("%c%d%c\n", s[i][0], len_s-2, s[i][len_s-1])
		} else {
			fmt.Println(s[i])
		}
	}
}

package main

import (
	"fmt"
)

func main(){
	var str string
	var n int
	fmt.Scanf("%d", &n)
	fmt.Scanln(&str)

	for i := 0; i < n; i++ {
		fmt.Scanln(&str)
		if len(str) <= 10 {
			fmt.Printf("%s\n", str)
			continue
		}

		fmt.Printf("%s%d%s\n", string(str[0]), len(str)-2, string(str[len(str)-1]))

	}
}

package main

import (
	 "fmt"
	 "strconv"
)

func tooLarge(x string) string {
	 var l int = len(x)
 	 if l > 10 {
 	 	return string(x[0]) + strconv.Itoa(l - 2) + string(x[l-1])
 	 } else {
 	 	return x
 	 }
}

func main() {
	var n int;
	var s string;
	fmt.Scan(&n);

	for i := 0; i<n; i ++ {
		  fmt.Scan(&s);
		  fmt.Println(tooLarge(s));
	}
}

package main

import (
	"fmt"
)

func main() {
	var str string
	var n int
	fmt.Scanf("%d", &n)
	fmt.Scanln(&str)

	for i := 0; i < n; i++ {
		fmt.Scanln(&str)
		if len(str) <= 10 {
			fmt.Printf("%s\n", str)
			continue
		}

		fmt.Printf("%s%d%s\n", string(str[0]), len(str)-2, string(str[len(str)-1]))

	}
}

// https://codeforces.com/problemset/problem/71/A
// cat inputs/longwords.txt | go run submissions/longwords2.go

// https://codeforces.com/contest/71/submission/47370552
// https://golang.org/pkg/fmt/#hdr-Printing
// fmt can take care of some of the conversions I was doing with string() and
// strconv.Itoa

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)

	scanner.Scan() // first value is not needed

	for scanner.Scan() {
		word := scanner.Text()
		length := len(word)

		if length > 10 {
			fmt.Printf("%c%d%c\n", word[0], length-2, word[length-1])
		} else {
			fmt.Println(word)
		}
	}
}

package main

import (
	"fmt"
)

func main(){
	var n int
	var word string
	fmt.Scanf("%d\n", &n)
	for i := 0; i < n; i++{
		fmt.Scanf("%s\n", &word)
		length := len(word)
		if length > 10{
			fmt.Printf("%c%d%c\n", word[0], length - 2, word[length - 1])
		}else{
			fmt.Println(word)
		}
	}
}

package main
import "fmt"

func main() {
  var n int
  fmt.Scanf("%d", &n)

  var word string
  var l int
  for i := 0; i <= n; i++ {
    fmt.Scanf("%s\n", &word)
    l = len(word)
    if l > 10 {
      fmt.Printf("%c%d%c\n", word[0], l - 2, word[l-1])
    } else {
      fmt.Printf("%s\n", word)
    }
  }
}

package main
import "fmt"
import "strconv"

func main(){
	var n int
	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		var str string
		fmt.Scan(&str)
		if len(str) > 10 {
			fmt.Println(string(str[0]) + strconv.Itoa(len(str) - 2) + string(str[len(str) - 1]))
		} else {
			fmt.Println(str)
		}
	}
}

package main

import (
	"bufio"
	"os"
	"strconv"
)

var w *bufio.Writer
var s *bufio.Scanner

const zero byte = '0'

func nextInt() uint8 {
	var num uint8
	s.Scan()
	for _, j := range s.Bytes() {
		num = num * 10 + j-zero
	}
	return num
}

func nextStr() string {
	s.Scan()
	return s.Text()
}
func main() {
	s = bufio.NewScanner(os.Stdin)
	w = bufio.NewWriter(os.Stdout)
	s.Split(bufio.ScanWords)
	t := nextInt()
	for t > 0 {
		word := nextStr()
		wordLength := len(word)
		if wordLength > 10 {
			w.WriteRune(rune(word[0]))
			w.WriteString(strconv.Itoa(wordLength - 2))
			w.WriteRune(rune(word[ wordLength - 1]))
			w.WriteByte('\n')
		}else {
			w.WriteString(word)
			w.WriteByte('\n')
		}
		t--
	}
	w.Flush()

}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	var t int
	scanner.Scan()
	t, _ = strconv.Atoi(scanner.Text())
	for t > 0 {
		scanner.Scan()
		word := scanner.Text()
		wordLength := len(word)
		if wordLength > 10 {
			word = string(word[0]) + strconv.Itoa(wordLength - 2) + string(word[wordLength - 1])
		}
		fmt.Println(word)
		t--
	}

}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	var (
		num int
	)
	reader := bufio.NewReader(os.Stdin)
	if val, _ := reader.ReadString('\n'); val != "" {
		num, _ = strconv.Atoi(strings.Split(val, "\r\n")[0])
	}
	arr := make([]string, num)
	for i:=0; i < num; i++ {
		if s, err := reader.ReadString('\n'); err == nil {
			arr[i] = strings.Split(s, "\r")[0]
		} else {
		    panic(err)
		}
	}
	for i := range arr {
		if len(arr[i]) > 10 {
			arr[i] = string(arr[i][0]) + strconv.Itoa(len(arr[i])-2) + string(arr[i][len(arr[i])-1])
		}
	}
	for i := range arr {
		fmt.Println(arr[i])
	}
}

package main

import (
    "fmt"
    "strconv"
)

func truncate(s string) string {
    return string(s[0]) + strconv.Itoa(len(s) - 2) + string(s[len(s) - 1])
}

func main() {
    var n int
    fmt.Scanf("%d\n", &n)
    for i := 1; i <= n; i++ {
        var s string
        fmt.Scanf("%s\n", &s)
        if len(s) > 10 {
            fmt.Println(truncate(s))
        } else {
            fmt.Println(s)
        }
    }
}

package main

import "fmt"

func main() {
  var w,length int
  fmt.Scanf("%d",&w)
  var word [200]string
  for i:=0; i<2*w; i++ {
    fmt.Scanf("%s",&word[i])
  }
  for i:=1; i<2*w; i+=2 {
    length = len(word[i])
    if length <= 10 {
      fmt.Printf("%s\n",word[i])
    } else {
      fmt.Printf("%c%d%c\n",word[i][0],length-2,word[i][length-1])
    }
  }
}

/*A. Way Too Long Words
time limit per test1 second
memory limit per test256 megabytes
inputstandard input
outputstandard output
Sometimes some words like "localization" or "internationalization" are so long that writing them many times in one text is quite tiresome.

Let's consider a word too long, if its length is strictly more than 10 characters. All too long words should be replaced with a special abbreviation.

This abbreviation is made like this: we write down the first and the last letter of a word and between them we write the number of letters between the first and the last letters. That number is in decimal system and doesn't contain any leading zeroes.

Thus, "localization" will be spelt as "l10n", and "internationalization» will be spelt as "i18n".

You are suggested to automatize the process of changing the words with abbreviations. At that all too long words should be replaced by the abbreviation and the words that are not too long should not undergo any changes.

Input
The first line contains an integer n (1 ≤ n ≤ 100). Each of the following n lines contains one word. All the words consist of lowercase Latin letters and possess the lengths of from 1 to 100 characters.

Output
Print n lines. The i-th line should contain the result of replacing of the i-th word from the input data.

Examples
inputCopy
4
word
localization
internationalization
pneumonoultramicroscopicsilicovolcanoconiosis
outputCopy
word
l10n
i18n
p43s
*/

package main

import "fmt"

func main() {
	var number_of_lines int
	fmt.Scanf("%d\n", &number_of_lines)

	for i := 0; i < number_of_lines; i++ {
		var word string
		fmt.Scanf("%s\n", &word)
		total_string_length := len(word)
		if total_string_length > 10 {
			first_character := string(word[0])
			replaced_string_length := total_string_length - 2
			last_character := string(word[total_string_length-1])

			fmt.Print(first_character, replaced_string_length, last_character, "\n")
		} else {
			fmt.Println(word)
		}
	}
}

package main

import (
	"fmt"
	"strconv"
)

func main() {
	var n int
	fmt.Scanf("%d\n", &n)
	words := make([]string, 0, n)
	for i := 0; i < n; i++ {
		var w string
		fmt.Scanf("%s\n", &w)
		words = append(words, w)
	}

	for _, w := range words {
		if len(w) > 10 {
			fmt.Println(string(w[0]) + strconv.Itoa(len(w)-2) + string(w[len(w)-1]))
		} else {
			fmt.Println(w)
		}
	}
}

package main

import "fmt"

func Solution(word string) string {
	if len(word) > 10 {
		return fmt.Sprintf("%c%d%c", word[0], len(word)-2, word[len(word)-1])
	} else {
		return word
	}
}

func main() {
	var num int
	fmt.Scanf("%d\n", &num)
	words := make([]string, num)
	answers := make([]string, 0)
	for i := 0; i < num; i++ {
		fmt.Scanf("%s\n", &words[i])
		answers = append(answers, Solution(words[i]))
	}

	for i := 0; i < num; i++ {
		fmt.Printf("%s\n", answers[i])
	}
}

package main

import (
  "fmt"
)

func main() {
	var count int
	fmt.Scanf("%d\n", &count)
	for i := 0; i < count; i++ {
		var word string
		fmt.Scanf("%s\n", &word)
		if len(word) > 10 {
			length := len(word)
			fmt.Print(string(word[0]))
			fmt.Print(length - 2)
			fmt.Println(string(word[length - 1]))
		} else {
			fmt.Println(word)
		}
	}
}

package main

import "fmt"

func main() {
	var n int
	fmt.Scanf("%d\n", &n)
	for i := 0; i < n; i++ {
		var s string
		fmt.Scanf("%s\n", &s)
		if len(s) > 10 {
			fmt.Printf("%c%d%c\n", s[0], len(s) - 2, s[len(s) - 1])
		} else {
			fmt.Printf("%s\n", s)
		}
	}
}

package main

import (
	"fmt"
)

func do(s string) string {
	if length := len(s); length > 10 {
		return fmt.Sprintf("%c%d%c", s[0], length-2, s[length-1])
	}
	return s
}

// func Test(t *testing.T) {
// 	a := assert.New(t)

// 	a.Equal("word", do("word"))
// 	a.Equal("l10n", do("localization"))
// 	a.Equal("i18n", do("internationalization"))
// 	a.Equal("p43s", do("pneumonoultramicroscopicsilicovolcanoconiosis"))
// 	a.Equal("abcdefghij", do("abcdefghij"))
// }

func main() {
	var n int
	var s string
	fmt.Scan(&n)
	for n > 0 {
		fmt.Scan(&s)
		fmt.Println(do(s))
		n--
	}
}

package main

import (
	"fmt"
)

func do(s string) string {
	if len := len(s); len > 10 {
		return fmt.Sprintf("%c%d%c", s[0], len-2, s[len-1])
	}
	return s
}

// func Test(t *testing.T) {
// 	a := assert.New(t)

// 	a.Equal("word", do("word"))
// 	a.Equal("l10n", do("localization"))
// 	a.Equal("i18n", do("internationalization"))
// 	a.Equal("p43s", do("pneumonoultramicroscopicsilicovolcanoconiosis"))
// }

func main() {
	var n int
	var s string
	fmt.Scan(&n)
	for n > 0 {
		fmt.Scan(&s)
		fmt.Println(do(s))
		n--
	}
}

package main

import (
	"fmt"
	"strings"
)

func main() {

	n := 1

	fmt.Scanf("%d\n", &n)

	for m := 0; m < n; m++ {
		var str string
		fmt.Scanf("%s\n", &str)

		if len(str) > 10 {
			parts := strings.Split(str, "")

			fmt.Printf("%s%d%s\n", parts[0], len(parts)-2, parts[len(parts)-1])
		} else {
			fmt.Printf("%s\n", str)
		}
	}

}

package main

import "fmt"

func main() {
	var T int
	fmt.Scanf("%d", &T)
	for i := 0; i < T; i++ {
		var s string
		fmt.Scanf("%s\n", &s)
		if len(s) <= 4 {
			fmt.Printf("%s\n", s)
		} else {
			fmt.Printf("%c%d%c\n", s[0], len(s) - 2, s[len(s) - 1])
		}
	}
}

package main
import (
	"fmt"
	"strconv"

	//"strconv"

)

func main() {
	var n int
	fmt.Scan(&n)
	s:=make([]string,n)
	for i:=0;i<n;i++{
		var a string
		fmt.Scan(&a)
		s=append(s,a)
	}
	var p2 string
	var p1 string
	var k3 string
	var k int

	for i:=0;i<len(s);i++{

		k3=s[i]
		for j:=0;j<len(k3);j++{
		p1=k3[0:1]
		p2=k3[len(k3)-1:len(k3)]
		}
		k=len(s[i])-2;
		s[i]=p1+strconv.Itoa(k)+p2

	}
	for i:=n;i<len(s);i++{

		fmt.Println(s[i])
	}

}

package main

import "fmt"

func main() {
  var lines int
  fmt.Scan(&lines)

  for i := 0; i < lines; i++ {
    var word string
    fmt.Scan(&word)
    if len(word) > 10{
      fmt.Sprintf("%s%d%s", string(word[0]), len(word)-2, string(word[len(word)-1]))
      continue
    }
    fmt.Println(word)
  }
}

package main

import "fmt"

const LONG_WORD_LEN int = 10

func main() {
        var n uint32
        fmt.Scanf("%d", &n)

        for n != 0 {
		var str string
                fmt.Scanf("%s", &str)

		length := len(str)
                if (length <= LONG_WORD_LEN) {
                        fmt.Println(str)
                } else {
                        fmt.Printf("%c%d%c\n", str[0], length - 2, str[length-1])
                }

                n--
        }
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
)

func main() {
	var number uint8
	_, _ = fmt.Scanln(&number)
	var stringVector []string

	for number > 0 {
		reader := bufio.NewReader(os.Stdin)
		iString, _ := reader.ReadString('\n')
		stringVector = append(stringVector, iString)
		number--
	}

	for i := 0; i < len(stringVector); i++ {

		temp := len(stringVector[i])
		if temp <= 10 {
			fmt.Print(stringVector[i])
		} else {
			word := strings.Split(stringVector[i], "")
			fmt.Print(word[0], temp-3, word[temp-2], "\n")
		}

	}
}

package main

import (
	"fmt"
)

func main() {
	n := nextInt()
	var a [100]string
	for i:=0; i<n; i++ {
		var word string
		fmt.Scanf("%s", &word)
		a[i] = word
	}

	for i:=0; i<n; i++ {
		word := a[i]
		if len(word) > 10 {
			fmt.Printf("%c%d%c", word[0], (len(word) - 2), (word[len(word) - 1]))
		} else {
			fmt.Printf("%s", word)
		}
		fmt.Println()
	}

}

func nextInt() int {
	var val int
	_, err := fmt.Scanf("%d", &val)
	if (err != nil) {
		fmt.Println(err)
	}
	return val
}

package main

import (
	"fmt"
)

func main() {
	var a [100]string
	var b, x, y int
	fmt.Scan(&b)
	for x = 0; x < b; x++ {
		fmt.Scan(&a[x])
	}
	for y = 0; y <= x; y++ {
		var i int
		i = len(a[y])
		if i <= 4 {
			fmt.Println(a[y])
		} else if i > 4 && i <= 10 {
			fmt.Print(string(a[y][0]))
			fmt.Print(string(a[y][1]))
			fmt.Print(i - 1)
			fmt.Print(string(a[y][i-1]))
			fmt.Println()
		} else {
			fmt.Print(string(a[y][0]))
			fmt.Print(i - 2)
			fmt.Print(string(a[y][i-1]))
			fmt.Println()
		}

	}
}

package main

import (
        "fmt"
)

func main() {
        var cases int
        fmt.Scanf("%d\n", &cases)
        for i := 0; i < cases; i++ {
                var str string
                fmt.Scanf("%s", &str)
                length := len(str)

                if length > 10 {
                        fmt.Printf("%c%d%c\n", str[0], length-2, str[length-1])
                } else {
                        fmt.Println(str)
                }
        }
        return
}

package main

import (
	"fmt"
	"strings"
)

func main() {

	n := 1

	fmt.Scanf("%d", &n)

	for m := 0; m < n; m++ {
		var str string
		fmt.Scanf("%s", &str)

		if len(str) > 10 {
			parts := strings.Split(str, "")

			fmt.Printf("%s%d%s\n", parts[0], len(parts)-2, parts[len(parts)-1])
		} else {
			fmt.Printf("%s\n", str)
		}
	}

}

package main

import "fmt"

func main() {
  var w,length int
  fmt.Scanf("%d",&w)
  var word [100]string
  for i:=0; i<w; i++ {
    fmt.Scanf("%s",&word[i])
  }
  for i:=0; i<w; i++ {
    length = len(word[i])
    if length <= 10 {
      fmt.Println(word[i])
    } else {
      fmt.Printf("%c%d%c\n",word[i][0],length-2,word[i][length-1])
    }
  }
}

package main

import (
	"fmt"
)

func main() {
	var x int
	fmt.Scanf("%d", &x)
	for i := 0; i < x; i++ {
		word := ""
		fmt.Scanf("%s", &word)
		if len(word) < 10 {
			println(word)
		} else {
			fmt.Printf("%s%d%s\n", string(word[0]), len(word[1:len(word) - 2]), string(word[len(word) - 1]))
		}
	}
}

package main

import (
	"fmt"
)

func main() {
	n := nextInt()
	var a [100]string
	for i:=0; i<n; i++ {
		var word string
		fmt.Scanf("%s", &word)
		a[i] = word
	}

	for i:=0; i<n; i++ {
		word := a[i]
		if len(word) > 10 {
			fmt.Printf("%c", word[0])
			fmt.Print((len(word) - 2))
			fmt.Printf("%c\n", word[len(word) - 1])
		} else {
			fmt.Printf("%s\n", word)
		}
	}

}

func nextInt() int {
	var val int
	_, err := fmt.Scanf("%d", &val)
	if (err != nil) {
		fmt.Println(err)
	}
	return val
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

type testCase struct {
	S     string
	ShrtS string
}

func main() {
	count := 0
	fmt.Scanf("%d", &count)
	var tests []*testCase
	in := bufio.NewReader(os.Stdin)
	for i := 0; i < count; i++ {
		t := &testCase{}
		t.S, _ = in.ReadString('\n')
		t.S = t.S[:len(t.S)-1]
		t.ShrtS = shorten(t.S)
		tests = append(tests, t)
	}
	for _, t := range tests {
		fmt.Println(t.ShrtS)
	}
}

func shorten(s string) string {
	if len(s) <= 10 {
		return s
	}
	ss := s[0:1]
	ss += strconv.Itoa(len(s) - 2)
	ss = ss + string(s[len(s)-1])
	return ss
}

package main

import (
	"fmt"
)

func main() {
	var w string
	fmt.Scanf("%s", &w)

	if len(w) == 4 {
		fmt.Println(w)
	} else if len(w) == 5 {
		fmt.Printf("%c3%c", w[0], w[len(w)-1])
	} else if len(w) > 6 {
		fmt.Printf("%c%d%c", w[0], len(w)-2, w[len(w)-1])
	}
}

package main
import "fmt"

func main() {
  var n int
  fmt.Scanf("%d", &n)

  var word string
  var l int
  for i := 0; i < n; i++ {
    fmt.Scanf("%s\n", &word)
    l = len(word)
    if l > 10 {
      fmt.Printf("%c%d%c\n", word[0], l - 2, word[l-1])
    } else {
      fmt.Printf("%s\n", word)
    }
  }
}

package main

import (
	"fmt"
	"bufio"
	"os"
)

func main() {
	var i uint8
	var n uint8
	fmt.Scanf("%d",&n)
	input := bufio.NewScanner(os.Stdin)
	var inStr string

	for ;i < n; i++{
		input.Scan()
		inStr = input.Text()
		if len(inStr) > 10 {
			fmt.Printf("%v%d%v\r\n",string(inStr[0]),len(inStr)-2,string(inStr[len(inStr) - 1]))
		}else {
			fmt.Println(inStr)
		}
	}
}

package main

import (
	"fmt"
	"os"
)

func main() {
	var count int
	var str string
	fmt.Scanf("%d", &count)

	for i := 0; i < count; i++ {
		fmt.Scanf("%s",&str)
		fmt.Fprintf(os.Stdout,"%s\n",longWords(str))
	}
}

func longWords(str string) string {
	if len(str) <= 10{
		return str
	}
	return fmt.Sprintf("%c%d%c",str[0],len(str[1:len(str)-1]),str[len(str)-1])
}

package main

import (
	"fmt"
)

func main(){
	var str string
	var n int
	fmt.Scanf("%d", &n)
	fmt.Scanln(&str)

	for i := 0; i < n; i++ {
		fmt.Scanln(&str)
		if len(str) <= 10 {
			fmt.Printf("%s\n", str)
			return
		}

		fmt.Printf("%s%d%s\n", string(str[0]), len(str)-2, string(str[len(str)-1]))

	}
}

package main

import "fmt"

func Solution(word string) string {
	if len(word) > 10 {
		return fmt.Sprintf("%c%d%c", word[0], len(word)-2, word[len(word)-1])
	} else {
		return word
	}
}

func main() {
	var num int
	fmt.Scanf("%d", &num)
	var words [110]string
	answers := make([]string, 0)
	for i := 0; i < num; i++ {
		fmt.Scanf("%s", &words[i])
		answers = append(answers, Solution(words[i]))
	}

	for i := 0; i < num; i++ {
		fmt.Println(answers[i])
	}
}

package main

import (
  "fmt"
)

func main(){
  var s string
  var n int
  fmt.Scanf("%d\n", &n)

  for j := 0; j<n; j++ {
    fmt.Scanf("%s\n", &s)
    i := len(s)
    if  i>= 10{
      fmt.Printf("%v%v%v", s[0], i-2, s[i-1])
    }else{
      fmt.Println(s)
    }
  }
}

package main

import (
	"fmt"
	"strconv"
)

func main() {
	var s string
	var t int

	fmt.Scanf("%d", &t)
	in := make([]string, 0, t)
	for i := 0; i < t; i++ {
		fmt.Scanf("%s", &s)
		in = append(in, s)
	    fmt.Println("Readed this : " + s)
	}

	for _, s := range in {
		if len(s) < 5 {
			fmt.Println(s)
		} else {
			fmt.Println(string(s[0]) + strconv.Itoa(len(s)-2) + string(s[len(s)-1]))
		}
	}
}

package main

import (
	"fmt"
)

func main(){
	var n int
	var word string
	fmt.Scanf("%d", &n)
	for i := 0; i < n; i++{
		fmt.Scanf("%s", &word)
		length := len(word)
		if length > 10{
			fmt.Printf("%c%d%c\n", word[0], length - 2, word[length - 1])
		}else{
			fmt.Println(word)
		}
	}
}

package main

import (
	"fmt"
)

func main() {
	var input string
	fmt.Scanln(&input)
	var length = len(input)
	if length-2 >= 10 {
		fmt.Printf("%c%d%c", input[0], length-2, input[length-1])
	}
}

package main

import "fmt"

func main() {
  var n int
  var a string
  var arr []string

  fmt.Scanln(&n)

  for i := 0; i < n; i++ {
    fmt.Scanln(&a)
    arr = append(arr, a)
  }

  for i := 0; i < n; i++ {
    a = arr[i]
    if len(a) > 10 {
      fmt.Println(fmt.Sprintf("%s%d%s", string(a[0]), len(a)-2, string(a[len(a)-1])))
    }
  }
}

package main

import "fmt"

const LONG_WORD_LEN int = 10

func main() {
        var n uint32
        fmt.Scanf("%d", &n)

        for n != 0 {
		var str string
                fmt.Scanf("%s", &str)

		length := len(str)
                if (length <= LONG_WORD_LEN) {
                        fmt.Println(str)
                } else {
                        fmt.Printf("%c%d%c\n", str[0], length - 2, str[length-1])
                }

                n--
        }
}

package main

import ("fmt")

func main() {
	var l int
	fmt.Scanf("%d", &l)
	var words []string
	for l > 0 {
		var s string
		fmt.Scanf("%s", &s)
		if len(s) > 10 {
			words = append(words, fmt.Sprintf("%c%d%c", s[0], len(s), s[len(s) - 1]))
		} else { words = append(words, s) }
		l = l - 1
	}
	for _, word := range(words) {
		fmt.Println(word)
	}
}

package main

import "fmt"

func Solution(word string) string {
	if len(word) > 10 {
		return fmt.Sprintf("%c%d%c", word[0], len(word)-2, word[len(word)-1])
	} else {
		return word
	}
}

func main() {
	var num int
	fmt.Scanf("%d\n", &num)
	var words [110]string
	answers := make([]string, 0)
	for i := 0; i < num; i++ {
		fmt.Scanf("%s", &words[i])
		answers = append(answers, Solution(words[i]))
	}

	for i := 0; i < num; i++ {
		fmt.Println(answers[i])
	}
}

package main

import (
	"fmt"
)

func main() {
	var w string
	fmt.Scanf("%s", &w)

	if len(w) == 4 {
		fmt.Println(w)
	} else if len(w) == 5 {
		fmt.Printf("%c3%c\n", w[0], w[len(w)-1])
	} else if len(w) > 6 {
		fmt.Printf("%c%d%c\n", w[0], len(w)-2, w[len(w)-1])
	}
}

package main

import (
        "bytes"
        "fmt"
        "strconv"
)

func main() {
        var num int
        var output bytes.Buffer
        fmt.Scanf("%d", &num)
        for i := 0; i < num; i++ {
                var input string
                fmt.Scanf("%s", &input)
                if len(input) <= 10 {
                        fmt.Println(input)
                } else {
                        inputByte := []byte(input)
                        output.WriteByte(inputByte[0])
                        output.WriteString(strconv.Itoa(len(input)-2))
                        output.WriteByte(inputByte[len(input)-1])
                        fmt.Println(output.String())
                }
                output.Reset()
        }
}

package main

import "fmt"

func main(){
     var s string
     var n int
     fmt.Scanf("%d", &n)
     for i := 0; i < n; i++ {
       fmt.Scanf("%s", &s)
       if len(s) > 10 {
          fmt.Printf("%c%d%c\n", s[0], len(s) - 2, s[len(s) - 1])
       } else {
          fmt.Printf("%s", s)
       }
     }
}

package main

import "fmt"

func Solution(word string) string {
	if len(word) > 10 {
		return (string)(fmt.Sprintf("%s%d%s", string(word[0]), len(word)-2, string(word[len(word)-1])))
	} else {
		return (string)(fmt.Sprintf("%s", word))
	}
}

func main() {
	var num int
	fmt.Scanf("%d\n", &num)
	var words [110]string
	for i := 0; i < num; i++ {
		fmt.Scanf("%s", &words[i])
		fmt.Println(Solution(words[i]))
	}
}

package main

import "fmt"

func main() {
  var n int
  fmt.Scanf("%d", &n)
  var s [100]string
  for i := 0; i < n; i++ {
    fmt.Scanf("%s", &s[i])
  }
  for i := 0; i < n; i++ {
    if (len(s[i]) > 10){
      fmt.Print(string(s[i][0]), len(s[i]) - 2, string(s[i][len(s[i]) - 1]), string('\n'))
    } else {
      fmt.Println(s[i])
    }
  }
}

package main

import (
	"fmt"
	"strconv"
)

func main() {
	n := 0
	fmt.Scanf("%d", &n)
	for i := 0; i < n; i++ {
		str := ""
		fmt.Scanf("%s", &str)
		l := len(str)
		if l > 10 {
			str = str[0:1] + strconv.Itoa(l-2) + str[l-1:l]
		}
		fmt.Println(str)
	}
}

package main

import "fmt"

func main() {
        var n uint32
        var length int
        var str string
        fmt.Scanf("%d", &n)

        for n != 0 {
                fmt.Scanf("%s", &str)
                length = len(str)
                if (length < 10) {
                        fmt.Println(str)
                } else {
                        fmt.Printf("%c%d%c\n", str[0], length - 2, str[length-1])
                }
                n--
        }
}

package main

import "fmt"

func main() {
	var (
		n   int
		msg string
	)
	_, _ = fmt.Scanf("%d", &n)

	for i := 0; i < n; i++ {
		_, _ = fmt.Scanf("%s", &msg)
		printAbbr(msg)
	}
}

func printAbbr(msg string) {
	if len(msg) > 10 {
		fmt.Printf("%c%d%c\n", msg[0], len(msg)-2, msg[len(msg)-1])
	} else {
		fmt.Print(msg)
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

type ShortString string

func (s ShortString) getShort() string {
	strLen := len(s)
	if strLen >= 10 {
		return string(s[0]) + strconv.Itoa(strLen-2) + string(s[strLen-1])
	}
	return string(s)
}

func main() {
	reader := bufio.NewReader(os.Stdin)
	nStr, _ := reader.ReadString('\n')
	nStr = strings.ReplaceAll(nStr, "\n", "")
	n, err := strconv.Atoi(nStr)

	if err == nil {
		for i := 0; i < n; i++ {
			text, _ := reader.ReadString('\n')
			text = strings.ReplaceAll(text, "\n", "")
			newText := ShortString(text)
			fmt.Printf("%s\n", newText.getShort())
		}
	}
}

package main

import "fmt"

// ShortenWord makes long words short, e.g. internationalization becomes i18n.
func ShortenWord(w string) string {
	if len(w) <= 10 {
		return w
	}

	return string(w[0]) + fmt.Sprintf("%d", len(w)-2) + string(w[len(w)-1])
}

func main() {
	var n int
	if _, err := fmt.Scanf("%d", &n); err != nil {
		return
	}

	var word string
	for i := 0; i < n; i++ {
		if _, err := fmt.Scanf("%q", &word); err != nil {
			continue
		}

		fmt.Println(ShortenWord(word))
	}
}

package main

import (
  "fmt"
)

func main(){
  var s string
  var n int
  fmt.Scanf("%d\n", &n)

  for j := 0; j<n; j++ {
    fmt.Scanf("%s\n", &s)
    i := len(s)
    if  i>= 10{
      fmt.Printf("%v%v%v", s[0], i-2, s[i-1])
    }else{
      fmt.Println(s)
    }
  }
}

package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scanf("%d", &n)
	var s string
	for i := 0; i < n; i++ {
		fmt.Scanf("%s", &s)
		if len(s) <= 10 {
			fmt.Println(s)
		} else {
			fmt.Printf("%c%d%c\n",s[0],len(s)-2,s[len(s)-1])
		}
	}
}

package main

import "fmt"

func main() {
  var n int
  fmt.Scanf("%d", &n)
  s := make([]string, n)
  for i := 0; i < n; i++ {
    fmt.Scanf("%s", &s[i])
  }
  for i := 0; i < n; i++ {
    if (len(s[i]) > 10){
      fmt.Print(string(s[i][0]), len(s[i]) - 2, string(s[i][len(s[i]) - 1]))
      fmt.Println()
    } else {
      fmt.Println((s[i]))
    }
  }
}

package main

import (
    "fmt"
)

func main() {
	var num int
    var words[] string
   	fmt.Scanln(&num)
    for i := 0; i < num; i++ {
        var word string
        fmt.Scanln(&word)
        words = append(words, word)
    }
    for _, str := range(words){
        if len(str) > 10{
            fmt.Printf("%s%d%s\n", string(str[0]), len(str)-2, string(str[len(str)-1]))
        }
    }
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

const lineDelim = '\r'

func TrimCRLF(s string) string {
	return strings.Trim(s, "\r \n")
}

func readInts(r *bufio.Reader) []int64 {
	str, _ := r.ReadString(lineDelim)
	str = TrimCRLF(str)
	numbersRaw := strings.Split(str, " ")
	var numbers []int64
	for _, i := range numbersRaw {
		n, _ := strconv.Atoi(i)
		numbers = append(numbers, int64(n))
	}

	return numbers
}

func readInt(r *bufio.Reader) int64 {
	str, _ := r.ReadString(lineDelim)
	str = TrimCRLF(str)
	n, _ := strconv.Atoi(str)

	return int64(n)
}

func readString(r *bufio.Reader) string {
	str, _ := r.ReadString(lineDelim)
	str = TrimCRLF(str)

	return str
}

func abbreviate(s string) string {
	return fmt.Sprintf("%s%d%s", string(s[0]), len(s)-2, string(s[len(s)-1]))
}

func main() {
	reader := bufio.NewReader(os.Stdin)
	n := readInt(reader)
	for i := 0; i < int(n); i++ {
		str := readString(reader)
		fmt.Printf("%#v\n", str)
		if len(str) > 10 {
			fmt.Println(abbreviate(str))
		} else {
			fmt.Println(str)
		}
	}

}

package main

import (
	"fmt"
)

func main() {
    var n int
    fmt.Scan(&n)
    for ;n > 0; n-- {
	    var str string
	    fmt.Scan(&str)
	    if len(str) > 10 {
	    	fmt.Printf("%s%d%s", str[:1], len(str)-2, str[len(str)-1:])
	    } else {
    		fmt.Println(str)
    	}
    }
}

package main

import (
	"fmt"
	"strconv"
)

func main() {
	n := 0
	fmt.Scanf("%d", &n)

	words := make([]string, n)

	for i := 0; i < n; i++ {
		fmt.Scanln(&words[i])
	}
	for i := 0; i < n; i++ {
		s := words[i]

		if len(s) > 10 {
			s = string(s[0]) + strconv.Itoa(len(s)-2) + string(s[len(s)-1])
		}
		fmt.Println(s)
	}
}

package main

import (
	"fmt"
)

func main() {
	var target int
	var results []string
	var w string

	fmt.Scanf("%d\n", &target)
	for i := 0; i < target; i++ {
		fmt.Scanf("%s\n", &w)
		if len(w) <= 10 {
			results = append(results, w)
		} else {
			results = append(results, fmt.Sprintf("%c%d%c", w[0], len(w), w[len(w)-1]))
		}
	}

	for _, result := range results {
		fmt.Println(result)
	}
}

package main

import "fmt"

func main() {
	var left int
	fmt.Scanf("%d", &left)

	for ; left > 0; left-- {
		var w string
		fmt.Scanf("%s", &w)
		fmt.Println(abbr(w))
	}
}

func abbr(w string) string {
	if len(w) < 10 {
		return w
	}

	f := w[0]
	l := w[len(w)-1]

	return fmt.Sprintf("%c%d%c", f, len(w)-2, l)
}

package main

import ("fmt"
        "strconv"
        )
func main() {
	var input int
	fmt.Scanf("%d",&input)

	stringArr := make([]string, input)
	for i := 0; i < input; i++ {
		fmt.Scanf("%s",&stringArr[i])
    length := len(stringArr[i])
    if  length > 10 {
      newString := string(stringArr[i][0]) + strconv.Itoa(length -2) + string(stringArr[i][length -1])
      stringArr[i] = newString
    }
	}
	for i := 0; i < input; i++ {
		fmt.Println(stringArr[i])
	}

}

package main

import "fmt"

func abbreviate(s string) string {
    var n int
    n = len(s);
    if n>=10 {
        return fmt.Sprintf("%c%d%c",s[0],n-2,s[n-1]);
    } else {
        return s;
    }
}

func main() {
    var n int
    fmt.Scanf("%d", &n);
    for i := 1; i <= n; i++ {
        var s string;
        fmt.Scanf("%s\n", &s);
        fmt.Println(abbreviate(s));
    }
}

package main

import (
	"fmt"
)

func main(){
	var n int
	var word string
	fmt.Scanf("%d", &n)
	for i := 0; i < n; i++{
		fmt.Scanf("%s", &word)
		length := len(word)
		if length > 10{
			fmt.Printf("%c%d%c\n", word[0], length - 2, word[length - 1])
		}else{
			fmt.Println(word)
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {

	var n int
	words := make([]string, 0)
	scanner := bufio.NewScanner(os.Stdin)

	_, _ = fmt.Scanf("%d", &n)

	if n > 0 {
		for i := 0; i < n; i++ {

			scanner.Scan()

			words = append(words, scanner.Text())
		}

		for j := 0; j < n; j++ {
			var wl = len(words[j])
			if wl > 10 {
				chunk0 := words[j][:1]
				chunk1 := words[j][1:wl - 1]
				chunk2 := words[j][wl-1:]

				fmt.Println(chunk0 + strconv.Itoa(len(chunk1)) + chunk2)
			} else {
				fmt.Println(words[j])
			}
		}
	}
}

package main

import (
	"bufio"
	. "fmt"
	"io"
	"os"
	"strconv"
)

func GO(_r io.Reader, _w io.Writer) {

	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()

	var T int
	var s string
	for Fscan(in, &T); T > 0; T-- {

		Fscan(in, &s)
		if len(s) <= T {
			Fprintln(out, s)
		} else {
			st := strconv.Itoa(len(s)-2)
			Fprintln(out, s[0:1]+st+s[len(s)-1:])
		}

	}

}

func main() {
	GO(os.Stdin, os.Stdout)
}

package main

import (
	"fmt"
)

func main() {
	var n int
	var input string
	ind := 0
	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		fmt.Scan(&input)
		if len(input) < 10 {
			fmt.Println(input)
		} else {
			for j, r := range input {
				if j == 0 {
					fmt.Print(string(r))
				} else if j == len(input)-1 {
					fmt.Print(ind)
					fmt.Println(string(r))
					ind = 0
				} else {
					ind++
				}
			}
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {

	var n int
	words := make([]string, 0)
	scanner := bufio.NewScanner(os.Stdin)

	_, _ = fmt.Scanf("%d", &n)

	if n > 0 {
		for i := 0; i < n; i++ {
			scanner.Scan()
			word := scanner.Text()
			words = append(words, word)
		}

		for j := range words {
			var wl = len(words[j])
			if wl > 10 {
				chunk0 := words[j][:1]
				chunk1 := words[j][1:wl - 1]
				chunk2 := words[j][wl-1:]

				fmt.Println(chunk0 + strconv.Itoa(len(chunk1)) + chunk2)
			} else {
				fmt.Println(words[j])
			}
		}
	}
}

package main

import (
	"fmt"
	"strconv"
)

func main() {
	n := 0
	fmt.Scanf("%d", &n)
	for i := 0; i < n; i++ {
		str := ""
		fmt.Scanf("%s\n", &str)
		l := len(str)
		if l > 10 {
			str = str[0:1] + strconv.Itoa(l-2) + str[l-1:l]
		}
		fmt.Printf("%s\n", str)
	}
}

package main

import "fmt"

// ShortenWord makes long words short, e.g. internationalization becomes i18n.
func ShortenWord(w string) string {
	if len(w) <= 10 {
		return w
	}

	return string(w[0]) + fmt.Sprintf("%d", len(w)-2) + string(w[len(w)-1])
}

func main() {
	var n int
	if _, err := fmt.Scanf("%d", &n); err != nil {
		return
	}

	var word string
	for i := 0; i < n; i++ {
		if _, err := fmt.Scanf("%s", &word); err != nil {
			continue
		}

		fmt.Println(ShortenWord(word))
	}
}

package main

import "fmt"

func main() {
  var n int
  fmt.Scanf("%d", &n)
  var s [100]string
  for i := 0; i < n; i++ {
    fmt.Scanf("%s", &s[i])
  }
  for i := 0; i < n; i++ {
    if (len(s[i]) > 10){
      fmt.Print(string(s[i][0]), len(s[i]) - 2, string(s[i][len(s[i]) - 1]), string('\n'))
    } else {
      fmt.Println(s[i])
    }
  }
}

package main

import "fmt"

func main() {
  var w,length int
  var word string
  fmt.Scanf("%d",&w)
  for i:=0; i<w; i++ {
    fmt.Scanf("%s",&word)
    length = len(word);
    if length <= 10 {
      fmt.Println(word);
    } else {
      fmt.Printf("%c%d%c",word[0],length-2,word[length-1])
    }
  }
}

package main

import "fmt"

func abbreviate(s string) string {
    var n int
    n = len(s);
    if n>=10 {
        return fmt.Sprintf("%c%d%c",s[0],n-2,s[n-1]);
    } else {
        return s;
    }
}

func main() {
    var n int
    fmt.Scanf("%d", &n);
    for i := 1; i <= n; i++ {
        var s string;
        fmt.Scanf("%s", &s);
        fmt.Println(abbreviate(s));
    }
}

package main

import (
	"bytes"
	"fmt"
	"strconv"
)

func main() {
	var n int
	var s string
	MaxLength := 10

	fmt.Scanf("%d", &n)
	for i := 0; i < n; i++ {
		fmt.Scanf("%s", &s)
		if len(s) > MaxLength {
			var buf bytes.Buffer
			buf.WriteByte(s[0])
			ins := len(s[1 : len(s)-1])
			buf.WriteString(strconv.Itoa(ins))
			buf.WriteByte(s[len(s)-1])
			fmt.Println(buf.String())
		} else {
			fmt.Println(s)
		}
	}
}

package main

import (
	"fmt"
	"strings"
)

func main() {
	var n string
	_, _ = fmt.Scanln(&n)

	strs := strings.Split(n, "\n")

	words := strs[1:]

	for _, word := range words {
		if len(n) < 4 {
			fmt.Sprintf(word)
		} else {
			f := word[0]
			l := word[len(word)-1]
			s := len(word) - 2
			fmt.Sprintf("%s%s%s", f, s, l)
		}
	}

}

// olymp
package main

import (
	"fmt"
)

func main() {
	var s string
	fmt.Scanf("%s", &s)
	if len(s) > 2 {
		fmt.Printf("%c%d%c\n", s[0], len(s)-2, s[len(s)-1])
	} else {
		fmt.Println(s)
	}
}

package main

import (
	"fmt"
	"strings"
)

func main() {
	var n string
	_, _ = fmt.Scanln(&n)

	strs := strings.Split(n, "\\n")

	words := strs[1:]

	for _, word := range words {
		if len(word) <= 10 {
			fmt.Sprintf(word)
		} else {
			f := string(word[0])
			l := string(word[len(word)-1])
			s := len(word) - 2
			fmt.Sprintf("%s%s%s", f, s, l)
		}
	}

}

package main

import "fmt"

func main() {
  var w,length int
  fmt.Scanf("%d",&w)
  var word string
  for i:=0; i<w; i++ {
    fmt.Scanf("%s",&word)
    length = len(word)
    if length <= 10 {
      fmt.Printf("%s\n",word)
    } else {
      fmt.Printf("%c%d%c\n",word[0],length-2,word[length-1])
    }
  }
}

package main

import "fmt"

func main() {
        var n uint32
        var length int
        var str string
        fmt.Scanf("%d", &n)

        for n != 0 {
                fmt.Scanf("%s", &str)
                length = len(str)
                if (length < 10) {
                        fmt.Println(str)
                } else {
                        fmt.Printf("%c%d%c\n", str[0], length - 2, str[length-1])
                }
                n--
        }
}

package main

import "fmt"

func main() {
  var n int
  var a string
  var arr []string

  fmt.Scanln(&n)

  for i := 0; i < n; i++ {
    fmt.Scanln(&a)
    arr = append(arr, a)
  }

  for i := 0; i < n; i++ {
    a = arr[i]
    if len(a) > 10 {
      fmt.Println(fmt.Sprintf("%s%d%s", string(a[0]), len(a)-2, string(a[len(a)-1])))
    }
  }
}

package main

import("fmt")

func main(){
    var n int
    var word string

    fmt.Scanf("%d", &n)

    for i := 0; i<n; i++{
        fmt.Scanf("%s", &word)
        if len(word) > 10{
            fmt.Printf("%c%d%c\n", word[0], len(word)-2, word[len(word)-1])
        } else{
            fmt.Println(word)
        }
    }
}

package main
import "fmt"

func main(){
    var n int
    var s string
    fmt.Scan(&n)

    for i:=0; i<n;i++{
        fmt.Scan(&s)
        if len(s)>4{
            fmt.Printf("%c%d%c\n", s[0], len(s) - 2, s[len(s) - 1])
        }else{
        fmt.Println(s)
        }
    }
}

package main

import "fmt"

func main() {
  var w,length int
  fmt.Scanf("%d",&w)
  var word [100]string
  for i:=0; i<w; i++ {
    fmt.Scanf("%s",&word[i])
  }
  for i:=0; i<w; i++ {
    if i > 0 {
      fmt.Printf("\n")
    }
    length = len(word[i])
    if length < 10 {
      fmt.Printf("%s",word[i])
    } else {
      fmt.Printf("%c%d%c",word[i][0],length-2,word[i][length-1])
    }
  }
}

package main

import (
	"fmt"
	"strconv"
)

func main() {
	var s string
	var t int

	fmt.Scanf("%d", &t)
	in := make([]string, 0, t)
	for i := 0; i < t; i++ {
		fmt.Scanf("%s", &s)
		in = append(in, s)
	}

	for _, s := range in {
		if len(s) < 5 {
			fmt.Println(s)
		} else {
			fmt.Println(string(s[0]) + strconv.Itoa(len(s)-2) + string(s[len(s)-1]))
		}
	}
}

package main

import (
	"bufio"
	. "fmt"
	"io"
	"os"
	"strconv"
)

func GO(_r io.Reader, _w io.Writer) {

	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()

	var T int
	var s string
	for Fscan(in, &T); T > 0; T-- {

		Fscan(in, &s)
		if len(s) <= T {
			Fprintln(out, s)
		} else {
			st := strconv.Itoa(len(s))
			Fprintln(out, s[0:1]+st+s[len(s)-1:])
		}

	}

}

func main() {
	GO(os.Stdin, os.Stdout)
}

package main

import (
	"fmt"
	"strconv"
)

func main() {
	n := 0
	fmt.Scanf("%d", &n)
	for i := 0; i < n; i++ {
		str := ""
		fmt.Scanf("%s\n", &str)
		l := len(str)
		if l > 10 {
			str = str[0:1] + strconv.Itoa(l-2) + str[l-1:l]
		}
		fmt.Printf("%s\n", str)
	}
}

package main

import (
	"fmt"
)

func main() {
	var count int
	fmt.Scanf("%d", &count)
	var words = make([]string,count)

	for i := 0; i < count; i++ {
		fmt.Scanf("%s\n",&words[i])
	}
	for it :=0; it < count;it++{
		fmt.Println(LongWords(&words[it]))
	}

}

func LongWords(str *string) string {
	if len(*str) <= 10{
		return *str
	}
	l := len(*str) - 1
	return fmt.Sprintf("%c%d%c",(*str)[0],len((*str)[1:l]),(*str)[l])
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

type testCase struct {
	S     string
	ShrtS string
}

func main() {
	count := 0
	fmt.Scanf("%d", &count)
	os.Stdin.Seek(0, 0)
	var tests []*testCase
	in := bufio.NewReader(os.Stdin)
	for i := 0; i < count; i++ {
		t := &testCase{}
		t.S, _ = in.ReadString('\n')
		t.S = t.S[:len(t.S)-1]
		t.ShrtS = shorten(t.S)
		tests = append(tests, t)
	}
	for _, t := range tests {
		fmt.Println(t.ShrtS)
	}
}

func shorten(s string) string {
	if len(s) <= 10 {
		return s
	}
	ss := s[0:1]
	ss += strconv.Itoa(len(s) - 2)
	ss = ss + string(s[len(s)-1])
	return ss
}

package main

import (
	"fmt"
)

func main() {
	var n int
	var arr []string

	fmt.Scan(&n)
	if n <= 0 {
		return
	}

	for i := 0; i < n; i++ {
		var x string
		fmt.Scan(&x)
		arr = append(arr, x)
	}

	for _, v := range arr {
		if len(v) <= 4 {
			fmt.Println(v)
			continue
		}
		fmt.Println(fmt.Sprintf("%s%d%s", substring(v, 0, 1), len(v)-2, substring(v, len(v)-1, len(v))))
	}
}

func substring(source string, start int, end int) string {
	var r = []rune(source)
	length := len(r)

	if start < 0 || end > length || start > end {
		return ""
	}

	if start == 0 && end == length {
		return source
	}

	return string(r[start:end])
}

package main

import (
	"bufio"
	. "fmt"
	"io"
	"os"
	"strconv"
)

func GO(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()

	var T int
	var s string
	Fscan(in, &T)
	Fscan(in, &s)
	if len(s) <= T {
		Fprintln(out, s)
	}else {
		st := strconv.Itoa(len(s))
		Fprintln(out, s[0:1]+st+s[len(s)-1:])
	}

}

func main() {
	GO(os.Stdin, os.Stdout)
}

package main

import "fmt"
func main() {
	var n int;
	var s string;
	fmt.Scan(&n);

	for i := 0; i<n; i ++ {
		  fmt.Scan(&s);
		  if len(s) > 10 {
		  		fmt.Printf("%c%d%c", s[0] ,len(s) - 2, s[len(s) - 1]);
		  } else {
		  		fmt.Println(s);
		  }
	}
}

package main

import (
	"fmt"
	"strconv"
)

func CreateResult(word string) string {
	var representation string
	if len(word) <= 10 {
		representation = word
	} else {
		representation = word[0:1] + strconv.Itoa(len(word[1:len(word)-1])) + word[len(word)-1:]
	}
	return representation
}

func main() {
	var n int
	fmt.Scanf("%d", &n)
	var words [100]string
	for i := 0; i < n; i++ {
		fmt.Scanf("%s", &words[i])
	}
	for i := 0; i < n; i++ {
		fmt.Println(CreateResult(words[i]))
	}
}

package main

import "fmt"

const (
	MAX_CHARS = 10
)

func main() {
	var n int
	fmt.Scanf("%d", &n)
	words := make([]string, n)
	for i := 0; i < n; i++ {
		fmt.Scanf("%s", &words[i])
	}

	for _, word := range words {
		length := len(word)
		if length > MAX_CHARS {
			fmt.Printf(fmt.Sprintf("%s%d%s", word[:1], length-2, word[length-1:]))
		} else {
			fmt.Printf(word)
		}
	}
}

package main

import "fmt"

func abbreviate(s string) string {
    var n int
    n = len(s);
    if n>=10 {
        return fmt.Sprintf("%c%d%c",s[0],n-2,s[n-1]);
    } else {
        return s;
    }
}

func main() {
    var n int
    fmt.Scanf("%d\n", &n);
    for i := 1; i <= n; i++ {
        var s string;
        fmt.Scanf("%s\n", &s);
        fmt.Println(abbreviate(s));
    }
}

package main

import (
	"fmt"
	"strconv"
)

func main() {

	var maxCount int
	var inputString string

	fmt.Scanf("%d", &maxCount)

	for counter := 0; counter < maxCount; counter++ {

		fmt.Scanf("%s", &inputString)
		length := len(inputString)

		if length > 10 {
			fmt.Println(string(inputString[0]) + strconv.Itoa(length-2) + string(inputString[length-1]))
		} else {
			fmt.Println(inputString)
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
)

func main() {
	var n uint8
	var scanner *bufio.Scanner
	var answers []string

	scanner = bufio.NewScanner(os.Stdin)
	fmt.Scanf("%d", &n)

	answers = make([]string, n)
	for i := uint8(0); i < n; i++ {
		scanner.Scan()
		answers[i] = solution(strings.TrimSpace(scanner.Text()))
	}

	for i := uint8(0); i < n; i++ {
		fmt.Println(answers[i])
	}
}

func solution(text string) string {
	var num uint8
	var numInStringFormat string
	if len(text) > 10 {
		num = uint8(len(text)) - 2
		numInStringFormat = itoa(num)
		return string(text[0]) + numInStringFormat + string(text[len(text)-1])
	}
	return text
}

func itoa(num uint8) string {
	var r uint8
	var nums []byte
	var count uint8
	var tenFold uint8
	var tmp []byte

	nums = []byte{48, 49, 50, 51, 52, 53, 54, 55, 56, 57}
	count = 1
	tenFold = 1

	for {
		if (num / (tenFold * 10)) < 1 {
			break
		} else {
			tenFold *= 10
			count++
		}
	}

	// fmt.Println(tenFold, count)

	tmp = make([]byte, count)

	for count > 0 {
		r = num % 10
		tmp[count-1] = nums[r]
		num = num - r
		num = num / 10
		count--
	}

	return string(tmp)
}

package main

import (
	"fmt"
)

func main() {
	var a string
	var inp int
	fmt.Scanf("%d\n", &inp)
	for i := inp; i > 0; {
		fmt.Scanf("%s\n", &a)
		if len(a) < 10 {
			fmt.Printf("%s\n", a)
		} else {
			fmt.Printf("%s%d%s\n", (string)(a[0]), (len(a) - 2), (string)(a[len(a)-1]))
		}
		i--
	}
}

package main

import "fmt"
func main() {
	var n int;
	var s string;
	fmt.Scan(&n);

	for i := 0; i<n; i ++ {
		  fmt.Scan(&s);
		  if len(s) > 10 {
		  		fmt.Printf("%c%d%c", s[0] ,len(s) - 2, s[len(s) - 1], "\n");
		  } else {
		  		fmt.Println(s);
		  }
	}
}

package main

import (
	"fmt"
	"strconv"
)

func main() {
	var (
		num int
	)
	fmt.Scanf("%d", &num)
	arr := make([]string, num)
	for i:=0; i < num; i++ {
		fmt.Scanf("%s", &arr[i])
	}
	for i := range arr {
		if len(arr[i]) > 10 {
			arr[i] = string(arr[i][0]) + strconv.Itoa(len(arr[i])) + string(arr[i][len(arr[i])-1])
		}
	}
	for i := range arr {
		fmt.Println(arr[i])
	}
}

package main

import (
	"fmt"
)

func main() {
	n := nextInt()
	var a [100]string
	for i:=0; i<n; i++ {
		var word string
		fmt.Scanf("%s", &word)
		a[i] = word
	}

	for i:=0; i<n; i++ {
		word := a[i]
		if len(word) > 10 {
			fmt.Printf("%c%d%c\n", word[0], (len(word) - 2), (word[len(word) - 1]))
		} else {
			fmt.Printf("%s\n", word)
		}
	}

}

func nextInt() int {
	var val int
	_, err := fmt.Scanf("%d", &val)
	if (err != nil) {
		fmt.Println(err)
	}
	return val
}

package main

import (
	"fmt"
	"strconv"
)

func main() {
	var s string
	var t int

	fmt.Scanf("%d", &t)
	in := make([]string, 0, t)
	for i := 0; i < t; i++ {
		fmt.Scan(&s)
		in = append(in, s)
	}

	for _, s := range in {
		if len(s) < 5 {
			fmt.Println(s)
		} else {
			fmt.Println(string(s[0]) + strconv.Itoa(len(s)-2) + string(s[len(s)-1]))
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strings"
)

func main() {
	reader := bufio.NewReaderSize(os.Stdin, 1024 * 1024)
	var x int
	fmt.Scanf("%d", &x)
	for i := 0; i < x; i++ {
		word := readLine(reader)
		if len(word) <= 10 {
			fmt.Println(word)
		} else {
			fmt.Printf("%s%d%s\n", string(word[0]), len(word) - 2, string(word[len(word) - 1]))
		}
	}
}

func readLine(reader *bufio.Reader) string {
	str, _, err := reader.ReadLine()
	if err == io.EOF {
		return ""
	}

	return strings.TrimRight(string(str), "\r\n")
}

package main

import (
	"fmt"
)

func main() {
	var target int
	var results []string
	var w string

	fmt.Scanf("%d\n", &target)
	for i := 0; i < target; i++ {
		fmt.Scanf("%s\n", &w)
		if len(w) <= 10 {
			results = append(results, w)
		} else {
			results = append(results, fmt.Sprintf("%c%d%c", w[0], len(w), w[len(w)-1]))
		}
	}

	for _, result := range results {
		fmt.Println(result)
	}
}

package main

import "fmt"

func main() {
  var w,length int
  fmt.Scanf("%d",&w)
  var word [100]string
  for i:=0; i<w; i++ {
    fmt.Scanf("%s",&word[i])
  }
  for i:=0; i<w; i++ {
    length = len(word[i])
    if length < 10 {
      fmt.Printf("%s",word[i])
    } else {
      fmt.Printf("%c%d%c",word[i][0],length-2,word[i][length-1])
    }
  }
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

type ShortString string

func (s ShortString) getShort() string {
	strLen := len(s)
	if strLen > 10 {
		return string(s[0]) + strconv.Itoa(strLen-2) + string(s[strLen-1])
	}
	return string(s)
}

func main() {
	reader := bufio.NewReader(os.Stdin)
	nStr, _ := reader.ReadString('\n')
	nStr = strings.ReplaceAll(nStr, "\n", "")
	n, err := strconv.Atoi(nStr)

	if err == nil {
		for i := 0; i < n; i++ {
			text, _ := reader.ReadString('\n')
			text = strings.ReplaceAll(text, "\n", "")
			newText := ShortString(text)
			//fmt.Printf("%s\n", newText.getShort())
			fmt.Println(newText.getShort())
		}
	}
}


package main

import (
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	var rows int

	fmt.Fscanln(os.Stdin, &rows)

	for i := 0; i < rows; i++ {
		var n int
		fmt.Fscanln(os.Stdin, &n)

		r := make([]string, 0)
		for j := n + 1; j > 0; {
			d := n / j
			j = n / (d + 1)

			r = append(r, strconv.Itoa(d))
		}

		fmt.Fprintln(os.Stdout, len(r))
		fmt.Fprintln(os.Stdout, strings.Join(r, " "))
	}
}

package main

import (
	"bufio"
	"errors"
	"fmt"
	"io"
	"math"
	"os"
	"sort"
	"strconv"
)

/*********** I/O ***********/

var (
	// ReadString returns a WORD string.
	ReadString func() string
	stdout     *bufio.Writer
)

func init() {
	ReadString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	// r.Buffer(make([]byte, 1024), int(1e+11)) // for AtCoder
	r.Buffer(make([]byte, 1024), int(1e+9)) // for Codeforces
	// Split sets the split function for the Scanner. The default split function is ScanLines.
	// Split panics if it is called after scanning has started.
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

// ReadInt returns an integer.
func ReadInt() int {
	return int(readInt64())
}
func ReadInt2() (int, int) {
	return int(readInt64()), int(readInt64())
}
func ReadInt3() (int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64())
}
func ReadInt4() (int, int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64()), int(readInt64())
}

// ReadInt64 returns as integer as int64.
func ReadInt64() int64 {
	return readInt64()
}
func ReadInt64_2() (int64, int64) {
	return readInt64(), readInt64()
}
func ReadInt64_3() (int64, int64, int64) {
	return readInt64(), readInt64(), readInt64()
}
func ReadInt64_4() (int64, int64, int64, int64) {
	return readInt64(), readInt64(), readInt64(), readInt64()
}

func readInt64() int64 {
	i, err := strconv.ParseInt(ReadString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// ReadIntSlice returns an integer slice that has n integers.
func ReadIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt()
	}
	return b
}

// ReadInt64Slice returns as int64 slice that has n integers.
func ReadInt64Slice(n int) []int64 {
	b := make([]int64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt64()
	}
	return b
}

// ReadFloat64 returns an float64.
func ReadFloat64() float64 {
	return float64(readFloat64())
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(ReadString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// ReadFloatSlice returns an float64 slice that has n float64.
func ReadFloat64Slice(n int) []float64 {
	b := make([]float64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadFloat64()
	}
	return b
}

// ReadRuneSlice returns a rune slice.
func ReadRuneSlice() []rune {
	return []rune(ReadString())
}

/*********** Debugging ***********/

// ZeroPaddingRuneSlice returns binary expressions of integer n with zero padding.
// For debugging use.
func ZeroPaddingRuneSlice(n, digitsNum int) []rune {
	sn := fmt.Sprintf("%b", n)

	residualLength := digitsNum - len(sn)
	if residualLength <= 0 {
		return []rune(sn)
	}

	zeros := make([]rune, residualLength)
	for i := 0; i < len(zeros); i++ {
		zeros[i] = '0'
	}

	res := []rune{}
	res = append(res, zeros...)
	res = append(res, []rune(sn)...)

	return res
}

/*********** DP sub-functions ***********/

// ChMin accepts a pointer of integer and a target value.
// If target value is SMALLER than the first argument,
//	then the first argument will be updated by the second argument.
func ChMin(updatedValue *int, target int) bool {
	if *updatedValue > target {
		*updatedValue = target
		return true
	}
	return false
}

// ChMax accepts a pointer of integer and a target value.
// If target value is LARGER than the first argument,
//	then the first argument will be updated by the second argument.
func ChMax(updatedValue *int, target int) bool {
	if *updatedValue < target {
		*updatedValue = target
		return true
	}
	return false
}

// NthBit returns nth bit value of an argument.
// n starts from 0.
func NthBit(num, nth int) int {
	return num >> uint(nth) & 1
}

// OnBit returns the integer that has nth ON bit.
// If an argument has nth ON bit, OnBit returns the argument.
func OnBit(num, nth int) int {
	return num | (1 << uint(nth))
}

// OffBit returns the integer that has nth OFF bit.
// If an argument has nth OFF bit, OffBit returns the argument.
func OffBit(num, nth int) int {
	return num & ^(1 << uint(nth))
}

// PopCount returns the number of ON bit of an argument.
func PopCount(num int) int {
	res := 0

	for i := 0; i < 70; i++ {
		if ((num >> uint(i)) & 1) == 1 {
			res++
		}
	}

	return res
}

/*********** Arithmetic ***********/

// Max returns the max integer among input set.
// This function needs at least 1 argument (no argument causes panic).
func Max(integers ...int) int {
	m := integers[0]
	for i, integer := range integers {
		if i == 0 {
			continue
		}
		if m < integer {
			m = integer
		}
	}
	return m
}

// Min returns the min integer among input set.
// This function needs at least 1 argument (no argument causes panic).
func Min(integers ...int) int {
	m := integers[0]
	for i, integer := range integers {
		if i == 0 {
			continue
		}
		if m > integer {
			m = integer
		}
	}
	return m
}

// Sum returns multiple integers sum.
func Sum(integers ...int) int {
	s := 0

	for _, i := range integers {
		s += i
	}

	return s
}

// PowInt is integer version of math.Pow
// PowInt calculate a power by Binary Power (二分累乗法(O(log e))).
func PowInt(a, e int) int {
	if a < 0 || e < 0 {
		panic(errors.New("[argument error]: PowInt does not accept negative integers"))
	}

	if e == 0 {
		return 1
	}

	if e%2 == 0 {
		halfE := e / 2
		half := PowInt(a, halfE)
		return half * half
	}

	return a * PowInt(a, e-1)
}

// AbsInt is integer version of math.Abs
func AbsInt(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

// Gcd returns the Greatest Common Divisor of two natural numbers.
// Gcd only accepts two natural numbers (a, b >= 1).
// 0 or negative number causes panic.
// Gcd uses the Euclidean Algorithm.
func Gcd(a, b int) int {
	if a <= 0 || b <= 0 {
		panic(errors.New("[argument error]: Gcd only accepts two NATURAL numbers"))
	}
	if a < b {
		a, b = b, a
	}

	// Euclidean Algorithm
	for b > 0 {
		div := a % b
		a, b = b, div
	}

	return a
}

// Lcm returns the Least Common Multiple of two natural numbers.
// Lcd only accepts two natural numbers (a, b >= 1).
// 0 or negative number causes panic.
// Lcd uses the Euclidean Algorithm indirectly.
func Lcm(a, b int) int {
	if a <= 0 || b <= 0 {
		panic(errors.New("[argument error]: Gcd only accepts two NATURAL numbers"))
	}

	// a = a'*gcd, b = b'*gcd, a*b = a'*b'*gcd^2
	// a' and b' are relatively prime numbers
	// gcd consists of prime numbers, that are included in a and b
	gcd := Gcd(a, b)

	// not (a * b / gcd), because of reducing a probability of overflow
	return (a / gcd) * b
}

// Strtoi is a wrapper of strconv.Atoi().
// If strconv.Atoi() returns an error, Strtoi calls panic.
func Strtoi(s string) int {
	if i, err := strconv.Atoi(s); err != nil {
		panic(errors.New("[argument error]: Strtoi only accepts integer string"))
	} else {
		return i
	}
}

// PrintIntsLine returns integers string delimited by a space.
func PrintIntsLine(A ...int) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.Itoa(A[i])
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintIntsLine returns integers string delimited by a space.
func PrintInts64Line(A ...int64) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.FormatInt(A[i], 10) // 64bit int version
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

/********** FAU standard libraries **********/

//fmt.Sprintf("%b\n", 255) 	// binary expression

/********** I/O usage **********/

//str := ReadString()
//i := ReadInt()
//X := ReadIntSlice(n)
//S := ReadRuneSlice()
//a := ReadFloat64()
//A := ReadFloat64Slice(n)

//str := ZeroPaddingRuneSlice(num, 32)
//str := PrintIntsLine(X...)

/*******************************************************************/

const MOD = 1000000000 + 7
const ALPHABET_NUM = 26
const INF_INT64 = math.MaxInt64
const INF_BIT60 = 1 << 60

var t int
var n int

func main() {
	t = ReadInt()

	for tc := 0; tc < t; tc++ {
		n = ReadInt()

		solve()
	}
}

func solve() {
	memo := make(map[int]int)
	memo[0] = 1
	memo[1] = 1

	for k := 1; k <= n; k++ {
		q := n / k
		memo[q] = 1
		if q <= k {
			break
		}
		memo[k] = 1
	}

	answers := []int{}
	for k := range memo {
		answers = append(answers, k)
	}
	sort.Sort(sort.IntSlice(answers))

	fmt.Println(len(answers))
	fmt.Println(PrintIntsLine(answers...))
}

/*
- MODは最後にとりましたか？
- ループを抜けた後も処理が必要じゃありませんか？
- 和・積・あまりを求められたらint64が必要ではありませんか？
*/

/*******************************************************************/

package main

import (
	"bufio"
	"errors"
	"fmt"
	"io"
	"math"
	"os"
	"sort"
	"strconv"
)

/*********** I/O ***********/

var (
	// ReadString returns a WORD string.
	ReadString func() string
	stdout     *bufio.Writer
)

func init() {
	ReadString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	// r.Buffer(make([]byte, 1024), int(1e+11)) // for AtCoder
	r.Buffer(make([]byte, 1024), int(1e+9)) // for Codeforces
	// Split sets the split function for the Scanner. The default split function is ScanLines.
	// Split panics if it is called after scanning has started.
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

// ReadInt returns an integer.
func ReadInt() int {
	return int(readInt64())
}
func ReadInt2() (int, int) {
	return int(readInt64()), int(readInt64())
}
func ReadInt3() (int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64())
}
func ReadInt4() (int, int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64()), int(readInt64())
}

// ReadInt64 returns as integer as int64.
func ReadInt64() int64 {
	return readInt64()
}
func ReadInt64_2() (int64, int64) {
	return readInt64(), readInt64()
}
func ReadInt64_3() (int64, int64, int64) {
	return readInt64(), readInt64(), readInt64()
}
func ReadInt64_4() (int64, int64, int64, int64) {
	return readInt64(), readInt64(), readInt64(), readInt64()
}

func readInt64() int64 {
	i, err := strconv.ParseInt(ReadString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// ReadIntSlice returns an integer slice that has n integers.
func ReadIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt()
	}
	return b
}

// ReadInt64Slice returns as int64 slice that has n integers.
func ReadInt64Slice(n int) []int64 {
	b := make([]int64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt64()
	}
	return b
}

// ReadFloat64 returns an float64.
func ReadFloat64() float64 {
	return float64(readFloat64())
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(ReadString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// ReadFloatSlice returns an float64 slice that has n float64.
func ReadFloat64Slice(n int) []float64 {
	b := make([]float64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadFloat64()
	}
	return b
}

// ReadRuneSlice returns a rune slice.
func ReadRuneSlice() []rune {
	return []rune(ReadString())
}

/*********** Debugging ***********/

// ZeroPaddingRuneSlice returns binary expressions of integer n with zero padding.
// For debugging use.
func ZeroPaddingRuneSlice(n, digitsNum int) []rune {
	sn := fmt.Sprintf("%b", n)

	residualLength := digitsNum - len(sn)
	if residualLength <= 0 {
		return []rune(sn)
	}

	zeros := make([]rune, residualLength)
	for i := 0; i < len(zeros); i++ {
		zeros[i] = '0'
	}

	res := []rune{}
	res = append(res, zeros...)
	res = append(res, []rune(sn)...)

	return res
}

/*********** DP sub-functions ***********/

// ChMin accepts a pointer of integer and a target value.
// If target value is SMALLER than the first argument,
//	then the first argument will be updated by the second argument.
func ChMin(updatedValue *int, target int) bool {
	if *updatedValue > target {
		*updatedValue = target
		return true
	}
	return false
}

// ChMax accepts a pointer of integer and a target value.
// If target value is LARGER than the first argument,
//	then the first argument will be updated by the second argument.
func ChMax(updatedValue *int, target int) bool {
	if *updatedValue < target {
		*updatedValue = target
		return true
	}
	return false
}

// NthBit returns nth bit value of an argument.
// n starts from 0.
func NthBit(num, nth int) int {
	return num >> uint(nth) & 1
}

// OnBit returns the integer that has nth ON bit.
// If an argument has nth ON bit, OnBit returns the argument.
func OnBit(num, nth int) int {
	return num | (1 << uint(nth))
}

// OffBit returns the integer that has nth OFF bit.
// If an argument has nth OFF bit, OffBit returns the argument.
func OffBit(num, nth int) int {
	return num & ^(1 << uint(nth))
}

// PopCount returns the number of ON bit of an argument.
func PopCount(num int) int {
	res := 0

	for i := 0; i < 70; i++ {
		if ((num >> uint(i)) & 1) == 1 {
			res++
		}
	}

	return res
}

/*********** Arithmetic ***********/

// Max returns the max integer among input set.
// This function needs at least 1 argument (no argument causes panic).
func Max(integers ...int) int {
	m := integers[0]
	for i, integer := range integers {
		if i == 0 {
			continue
		}
		if m < integer {
			m = integer
		}
	}
	return m
}

// Min returns the min integer among input set.
// This function needs at least 1 argument (no argument causes panic).
func Min(integers ...int) int {
	m := integers[0]
	for i, integer := range integers {
		if i == 0 {
			continue
		}
		if m > integer {
			m = integer
		}
	}
	return m
}

// Sum returns multiple integers sum.
func Sum(integers ...int) int {
	s := 0

	for _, i := range integers {
		s += i
	}

	return s
}

// PowInt is integer version of math.Pow
// PowInt calculate a power by Binary Power (二分累乗法(O(log e))).
func PowInt(a, e int) int {
	if a < 0 || e < 0 {
		panic(errors.New("[argument error]: PowInt does not accept negative integers"))
	}

	if e == 0 {
		return 1
	}

	if e%2 == 0 {
		halfE := e / 2
		half := PowInt(a, halfE)
		return half * half
	}

	return a * PowInt(a, e-1)
}

// AbsInt is integer version of math.Abs
func AbsInt(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

// Gcd returns the Greatest Common Divisor of two natural numbers.
// Gcd only accepts two natural numbers (a, b >= 1).
// 0 or negative number causes panic.
// Gcd uses the Euclidean Algorithm.
func Gcd(a, b int) int {
	if a <= 0 || b <= 0 {
		panic(errors.New("[argument error]: Gcd only accepts two NATURAL numbers"))
	}
	if a < b {
		a, b = b, a
	}

	// Euclidean Algorithm
	for b > 0 {
		div := a % b
		a, b = b, div
	}

	return a
}

// Lcm returns the Least Common Multiple of two natural numbers.
// Lcd only accepts two natural numbers (a, b >= 1).
// 0 or negative number causes panic.
// Lcd uses the Euclidean Algorithm indirectly.
func Lcm(a, b int) int {
	if a <= 0 || b <= 0 {
		panic(errors.New("[argument error]: Gcd only accepts two NATURAL numbers"))
	}

	// a = a'*gcd, b = b'*gcd, a*b = a'*b'*gcd^2
	// a' and b' are relatively prime numbers
	// gcd consists of prime numbers, that are included in a and b
	gcd := Gcd(a, b)

	// not (a * b / gcd), because of reducing a probability of overflow
	return (a / gcd) * b
}

// Strtoi is a wrapper of strconv.Atoi().
// If strconv.Atoi() returns an error, Strtoi calls panic.
func Strtoi(s string) int {
	if i, err := strconv.Atoi(s); err != nil {
		panic(errors.New("[argument error]: Strtoi only accepts integer string"))
	} else {
		return i
	}
}

// PrintIntsLine returns integers string delimited by a space.
func PrintIntsLine(A ...int) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.Itoa(A[i])
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintIntsLine returns integers string delimited by a space.
func PrintInts64Line(A ...int64) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.FormatInt(A[i], 10) // 64bit int version
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

/********** FAU standard libraries **********/

//fmt.Sprintf("%b\n", 255) 	// binary expression

/********** I/O usage **********/

//str := ReadString()
//i := ReadInt()
//X := ReadIntSlice(n)
//S := ReadRuneSlice()
//a := ReadFloat64()
//A := ReadFloat64Slice(n)

//str := ZeroPaddingRuneSlice(num, 32)
//str := PrintIntsLine(X...)

/*******************************************************************/

const MOD = 1000000000 + 7
const ALPHABET_NUM = 26
const INF_INT64 = math.MaxInt64
const INF_BIT60 = 1 << 60

var t int
var n int

func main() {
	t = ReadInt()

	for tc := 0; tc < t; tc++ {
		n = ReadInt()

		solve()
	}
}

func solve() {
	memo := make(map[int]int)
	memo[0] = 1

	// for k := 1; k <= n; k++ {
	// 	q := n / k
	// 	memo[q] = 1
	// 	if q <= k {
	// 		break
	// 	}
	// 	memo[k] = 1
	// }
	for k := 1; k*k <= n; k++ {
		memo[n/k] = 1
		memo[k] = 1
	}

	answers := []int{}
	for k := range memo {
		answers = append(answers, k)
	}
	sort.Sort(sort.IntSlice(answers))

	fmt.Println(len(answers))
	fmt.Println(PrintIntsLine(answers...))
}

/*
- MODは最後にとりましたか？
- ループを抜けた後も処理が必要じゃありませんか？
- 和・積・あまりを求められたらint64が必要ではありませんか？
*/

/*******************************************************************/

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main()  {
	var reader = bufio.NewReader(os.Stdin)
	var writer = bufio.NewWriter(os.Stdout)
	var nt int
	var n int

	defer writer.Flush()

	fmt.Fscanf(reader, "%d\n", &nt)

	for t:=0; t < nt; t++ {
		fmt.Fscanf(reader, "%d\n", &n)

		var res = make([] int, 0)
		res = append(res, 0)

		var cur = n
		for {
			var roundValue = n / cur
			var foundValue = cur

			var l = 1
			var r = cur

			for l <= r {
				var mid = (l + r) >> 1

				if n / mid == roundValue {
					foundValue = mid
					r = mid - 1
				} else {
					l = mid + 1
				}
			}
			res = append(res, roundValue)
			cur = foundValue - 1
			if cur == 0 {
				break
			}
		}

		var sz = len(res)
		fmt.Fprintf(writer, "%d\n", sz)
		for i := 0; i < sz; i++ {
			fmt.Fprintf(writer,"%d ", res[i])
		}
		fmt.Fprintf(writer,"\n")
	}

}