Skip to content

Commit dec504b

Browse files
authored
String reverse in Java with StringBuilder
1 parent 0be625f commit dec504b

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

Solution.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import java.io.*;
2+
import java.util.*;
3+
4+
public class Solution {
5+
6+
public static void main(String[] args) {
7+
8+
Scanner sc=new Scanner(System.in);
9+
String A=sc.next();
10+
StringBuilder input = new StringBuilder();
11+
input.append(A);
12+
input = input.reverse();
13+
14+
if(input.toString().equalsIgnoreCase(A)){
15+
System.out.println("Yes");
16+
}
17+
else
18+
System.out.println("No");
19+
20+
21+
}
22+
}
23+
24+
25+

0 commit comments

Comments
 (0)