wipro MileStone(shift char size)


##wipro milestone Question

###find the word length shift char size
input :ab def
output:cd ghi

Following is sample java code.

import java.util.*;
public class Main {
    public static void main(String[] args) {
     Scanner sc = new Scanner(System.in);
     String s=sc.nextLine();
     String s1[]=s.split(" ");
     String s2="a b c d e f g h i j k l m n o p q r s t u v w x y z";
     String hash[]=s2.split(" ");
     String q="";
     for(int i=0;i<s1.length;i++)
     {
      String w="";
      int len=s1[i].length();
      String e=s1[i];
      for(int j=0;j<len;j++){
        int t=(int) e.charAt(j)-97;
        int y=t+len;
        if(y<=26)
        {
          w=w+hash[y];
        }
        else{
          w=w+hash[0+len-1];
        }
        
         
      }
      if(i<s1.length-1){
       q+=w+" ";
      }
      else{
        q+=w;
      }
     }
     System.out.print(q);
  }
}