Created
March 25, 2015 06:49
-
-
Save shohan4556/4e9c155f67a0574d2b5f to your computer and use it in GitHub Desktop.
Uva 483 Word Scramble solution in java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Author : Md.Shohanur Rahaman | |
import java.util.Scanner; | |
import java.lang.StringBuffer; | |
public class Main { | |
public static void main(String args[]){ | |
Scanner input=new Scanner(System.in); | |
String str; | |
while(input.hasNext()){ | |
str=input.nextLine(); | |
String[] ara=str.split(" "); | |
for(int i=0;i<ara.length;i++){ | |
StringBuffer tmp1=new StringBuffer(ara[i]); | |
if(i==ara.length -1){ | |
System.out.print(tmp1.reverse().toString()); | |
break; | |
} | |
tmp1.reverse().toString(); | |
System.out.print(tmp1+" "); | |
} | |
System.out.println(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment