String s is a palindrome, namely so-called palindrome forward, reverse spelling are a
Sample, such as a, eye, ABBA, etc., when the string is a palindrome, s function
The return value is true, otherwise, the return value is false.
CodePudding user response:
AnsiString SS=Edit1 - & gt; The Text;Int L=SS. The Length ();
For (int I=1; I & lt;=L/2; I++)
{
If (SS [I]!=SS/L + 1 - I)
{
ShowMessage (" palindrome ");
break;
}
Else if (I==L/2)
{
ShowMessage (" is a palindrome ");
}
}
CodePudding user response:
01. # include & lt; Stdio. H>
02. # include & lt; Stdlib. H>
03. # include & lt; String. H>
04.
05. Int main ()
06. {
7. The char STR [1001];
08. Int len, flag, I;
09.
10. While (the scanf (" % s ", STR)!=(EOF)
11. {
12. The flag=1;
13. Len=strlen (STR);
14.
15. The for (I=0; I & lt; Len/2; I + +)
16. {
17. The if (STR [I]!=STR [-i len - 1])
18. {
19. The flag=0;
20. Break;
21.}
22.}
23. The if (flag)
24. The printf (" Yes! \n");
25. The else
26. The printf (" No! \n");
27.}
28.
29. The return 0;
30.}