import java.util.ArrayList;
import java.util.*;
import java.util.Scanner;
public class String10 {
public static void main(String[] args) {
int left, right=0;
Scanner sc=new Scanner(System.in);
System.out.println("enter the String");
String st=sc.nextLine();
String words[]=st.split(" ");
char ch[]=st.toCharArray();
List <Character> list=new ArrayList<>();
for(char c:ch){
list.add(c);
}
Collections.reverse(list);
Iterator it=list.iterator();
while(it.hasNext()){
System.out.print(it.next());
}
}
}
Output :
welcome to dashzinnizhsad ot emoclew
0 comments:
Post a Comment