Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit fd4ce03

Browse files
Merge pull request fnplus#166 from TharinduMD/new-branch
Palindrome for a sentence
2 parents f8f74d6 + 45a7d59 commit fd4ce03

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import java.util.Scanner;
2+
class Pallindrome_string{
3+
public static void pallindrome(String word){
4+
word = word.toLowerCase();
5+
word = word.replace(" ","");
6+
7+
int c=0,x=word.length();
8+
for(int i=0;i<x;i++){
9+
if(word.charAt(i) == word.charAt(x-1-i)){
10+
c++;
11+
}
12+
}
13+
if(c == x)
14+
System.out.println("Pallindrom");
15+
else
16+
System.out.println("Not Pallindrom");
17+
}
18+
public static void main(String args[]){
19+
Scanner sc = new Scanner(System.in);
20+
System.out.print("Enter a word:");
21+
String word = sc.nextLine();
22+
23+
pallindrome(word);
24+
}
25+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /