Skip to content

Commit

Permalink
Update PalindromeChecker.java
Browse files Browse the repository at this point in the history
  • Loading branch information
Ny09-sand authored Feb 8, 2025
1 parent 8a6803a commit 67548b6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/java/PalindromeChecker.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ public void tester()
}
public boolean palindrome(String word)
{
String no_space= " " ;
for ( int i = 0 ; i < word.length()-1;i ++){
String no_space= "" ;
for ( int i = 0 ; i < word.length();i ++){
if (!word.substring(i,i+1).equals(" " )){
no_space+=word.substring(i,i+1);
}
}
return (no_space.equals(reverse(word)));
return no_space.equals(reverse(no_space));
}
public String reverse(String str)
{
Expand Down

0 comments on commit 67548b6

Please sign in to comment.