I am trying to solve this problem on CodeForces. I came up with a solution and submitted it. However it is showing wrong answer on both testcases though it works completely fine on my system. Is anything wrong with the solution below? :
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <iostream>
using namespace std;
int main(int argc,const char *argv[]){
string userInput;
int t;
scanf("%d",&t);
while(t--){
cin >> userInput;
if(userInput.length()<10){
cout << userInput << "\n";
}
else{
int n = userInput.length() - 2;
cout << userInput[0] << n << userInput[n+1] << "\n";
}
}
return 0;
}