Rafan_Haizar's blog

By Rafan_Haizar, history, 13 months ago, In English

Hi, I'm rafan haizar. I'm just 11yrs old. Today this happened while I solving "A — Way Too Long Words" problem.

This is the code :--

import java.util.Scanner;

/** * * @author abdul */ public class CodeForces {

public static void main(String[] args) {
    Scanner sc=new Scanner(System.in);
    int w=sc.nextInt();
    String s=null;
    if(w>=1&&w<=100){
        for(int i=1;i<=w;i++){
            s=sc.next();
            if(s.length()>0&&s.length()<100){
                if(s.length()>10){
                    char[] v=s.toCharArray();
                    char f=v[0];
                    int sz=v.length-2;
                    char o=v[v.length-1];
                    System.out.println(f+""+sz+""+o);
                }else{
                    System.out.println(s);
                }
            }
        }
    }
}

} Please Help Mee.

  • Vote: I like it
  • -5
  • Vote: I do not like it

| Write comment?