{public static void main(String args[])
{ int i,j,k,l,lp,counter=0;
String m="my mom chocolate cake icecream arora madam dog coco kaka itat papa",n="",o,p="";
char ch=' ',ph=' ',bh=' ',kh=' ';
l=m.length();
// loop
for(i=0;i<l;i++)
{ch=m.charAt(i);
if(ch==' '){break;}
p=m.substring(0,i);
continue;}
lp=p.length();
for(j=lp-1;j>=0;j--)
{ch=p.charAt(j);
n=n+ch;System.out.println(n);
}if(n.equalsIgnoreCase(p));
{System.out.println("The word is pallindrome");
System.out.println(p);
counter++;
}System.out.println("nos of pallindrome words="+counter);}
}
[\code]
This post has been edited by priya_lorha: 18 January 2009 - 06:52 AM

New Topic/Question
Reply




MultiQuote









|