Friday, 5 June 2020

Codeforces-71A (Way Too Long Words)

Program

import java.util.Scanner;
public class cp71A
{
    public static void main(String args[ ])
        {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int i=0,j=0;
        String s[] = new String[n+1];  

        for(i=0;i<n+1;i++)
       {
            s[i] = sc.nextLine();
       }
        for(j=0;j<n+1;j++)
       {
            if(s[j].length()<=10)
            {
                System.out.println(s[j]);
            }
            else
            {
                System.out.print(s[j].charAt(0));
                System.out.print(s[j].length()-2);
                System.out.print(s[j].charAt(s[j].length()-1));      
            }
            System.out.println();
        }
    }
}
Watch Codeforces-1A (Theatre Square) Solution  - https://www.techrcoding.com/2020/06/1A.html

No comments:

Post a Comment