String word = "What's up? Did Sara's mom fly on a 74-7?"
public String getPalindromes()
{
String result = "",y = "";
String AZ = "abcdefghijklmnopqrstuvwxyz1234567890";
String x = "`~!@#$%^&*()-_+?<>,./'";
for (int j = 0; j
{
if (x.indexOf(word.charAt(j)) == -1)
y += word.charAt(j);
}
//System.out.println("\n" +y);
input = new Scanner(y);
while (input.hasNext())
{
String word = input.next();
String back = word.toLowerCase();
String temp = "";
for (int i = back.length()-1; i>=0; i--)
{
if (AZ.indexOf(back.charAt(i)) != -1)
temp = temp + back.charAt(i);
}
input = new Scanner(word);
//System.out.println(temp);
if (back.equalsIgnoreCase(temp))
result += temp + " ";
}
return result;
how do I get a result of Did Sara's mom a 74-7 instead of did saras mom a 747 which I have right now?
2006-10-29
05:00:39
·
3 answers
·
asked by
?
1
in
Computers & Internet
➔ Programming & Design
I followed Gizmo's suggestion but it didn't work
2006-10-29
05:48:52 ·
update #1