-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstring_rev.java
42 lines (38 loc) · 1.18 KB
/
string_rev.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import java.util.Scanner;
class string_rev{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
String str = sc.next();
sc.close();
// System.out.println(str);
StringBuilder st = new StringBuilder(str);
st.reverse();
if(str.equals(st.toString())){
System.out.println(true);
}
else{
System.out.println(false);
}
// System.out.println(st.toString());
// char ch[] = str.toCharArray();
// System.out.println(ch);
// String rev = "";
// sc.close();
// System.out.println(ch.length);
// for(int i = ch.length ; i > 0 ; i--){
// // System.out.println(i)
// System.out.println(ch[i]);
// rev = rev + ch[i];
// // rev += ch[i];
// System.out.println(rev);
// }
// System.out.println(rev);
// if(str == rev){
// System.out.println("yes");
// }
// else{
// System.out.println("no");
// }
// System.out.println(str.length());
}
}