Advertisement
Guest User

Untitled

a guest
Sep 21st, 2014
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.40 KB | None | 0 0
  1. public static void changeString(String in){
  2.             String out[] = in.split(" ");
  3.            
  4.             for(int j = 0; j < out.length; j++){
  5.                 for(int i = 1; i < out[j].length(); i = i+2){
  6.                     System.out.print(out[j].charAt(i));
  7.                     System.out.print(out[j].charAt(i-1));
  8.                 }
  9.                 if(out[j].length() % 2 != 0){
  10.                     System.out.print(out[j].charAt(out[j].length()-1));
  11.                 }
  12.                 System.out.print(" ");
  13.             }
  14.            
  15.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement