#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  string a, b;
  char yee;
  cin >> n;
  for (int i = 0; i < n; i++) {
    b = "";
    cin >> a;
    if (a.length() > 10) {
      m = a.length() - 2;
      while (m > 0) {
        yee = m % 10 + 48;
        b = yee + b;
        m = m / 10;
      }
      b = a[0] + b;
      b += a[a.length() - 1];
      b += 10;
      cout << b;
    } else {
      a += 10;
      cout << a;
    }
  }
}
