I need help on this program it takes in a string e.g abc 121 123 abba acca.
Then the output is Valid Palindromes are abba acca (It doesnt count numbers as palindromes)
How do i seperate each word without using arrays?
I wrote this code for the start but it only takes in the above string and writes it backwards which is what but i need to know how do i get it not to count the numbers and the words that arent palindromes i need the long version dont use scanners or arrays thanks

System.out.println("Enter a string");
string = EasyIn.getString();

for(index = name.length()-1 ;index >= 0 ; index--)
System.out.print(" "+ name.charAt(index) ) ;


Thanks a million

Firstly to separate out the words in the string, you could use the StringTokenizer class and split the string based on space chars.

Secondly stack is a common data structure used for checking palindromes, so that you push every character from a word into the stack till you are half way through the word then for every char from the word, you pop one out of the stack and compare them. If both are the same you move forward. If in this way you are able to reach the end of the string, you can conclude it is a palindrome.

Note : Special processing is required for strings with odd number o characters, you would have to omit the character in the middle. For e.g. ISI, drop S from being checked, hope you get it.