public class Print {
public static void main(String[] args) {
String word = "hello world welcome to java";
String [] s=word.split(" ");
for (int i = 0; i < s.length; i++) {
for (int j = s[i].length()-1; j >=0 ; j--) {
System.out.print(s[i].charAt(j));
}
System.out.print(" ");
}
}
}
|