Skip to content

Instantly share code, notes, and snippets.

@Jack-Saleem
Created January 15, 2016 13:08
Show Gist options
  • Select an option

  • Save Jack-Saleem/2fcf9e8a5b88c97d6562 to your computer and use it in GitHub Desktop.

Select an option

Save Jack-Saleem/2fcf9e8a5b88c97d6562 to your computer and use it in GitHub Desktop.
Codeforces 71A WayTooLongWords program in java
import java.util.Scanner;
public class waytoolongwords
{
public static void main(String[] args)
{
Scanner ip = new Scanner(System.in);
int num=ip.nextInt();
String[] str = new String[num];
for(int i=0;i<num;i++)
{
String x=ip.next();
str[i]=x;
}
for(int i=0;i<num;i++)
{
if(str[i].length()>10)
{
int y=str[i].length()-2;
int z=str[i].length()-1;
System.out.println(str[i].charAt(0)+""+y+""+str[i].charAt(z));
}
else
System.out.println(str[i]);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment