Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: palindrome

  1. #1
    New to the CF scene
    Join Date
    Nov 2016
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    palindrome

    how can a split function be used to find the palindrome words in a sentence.... can anybody suggest me some another way , i am open to taking as long and stressful codes as possible but i want a solution to it or an explanation of the split function so that i can find and print palindrome words from a inputted string.

  2. #2
    New Coder
    Join Date
    Oct 2016
    Posts
    88
    Thanks
    0
    Thanked 9 Times in 9 Posts
    What do you mean by split function?

    You can use StringTokenizer to break your input up into individual words. Send each word to isPalindrome() method, which you will write. Using a FOR loop, you can quickly tell if a word is a palindrome or not. Get the first character in the word and compare it to the last character. If true, continue moving inward from both sides of the word. If they don't match, it's not a palindrome.


 

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •