We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4986f7c commit 33ab1ceCopy full SHA for 33ab1ce
1 file changed
String Handling/stringPalindrome.java
@@ -0,0 +1,22 @@
1
+import java.util.*;
2
+public class Main
3
+{
4
+ public static void main(String[] args) {
5
+ Scanner sc=new Scanner(System.in);
6
+ System.out.println("Enter a String");
7
+ String s=sc.nextLine();
8
+ int l=s.length();
9
+ int temp=0;
10
+ for(int i=0,j=l-1;i<=j;i++,j--)
11
+ {
12
+ if(s.charAt(i)!=s.charAt(j))
13
14
+ System.out.println("Not Palindrome");
15
+ temp=1;
16
+ break;
17
+ }
18
19
+ if(temp==0)
20
+ System.out.println("Palindrome");
21
22
+}
0 commit comments