java program to input any string then print each word along with their length
Answers
Answered by
1
import java.util.Arrays;
import java.util.Scanner;
class WordSort{
public static void main(String[] args){
Scanner sc= new Scanner(System.in);
String word="";
while((word=sc.next()).length() >0){
char [] chars=word.toCharArray();
Arrays.sort(chars);
System.out.print((new String(chars))+" ");
}
}
}
Similar questions