做错了。
回文:
3 olleh !dlrow m'I morf .udh I ekil .mca |
Sample Output
hello world! I'm from hdu. I like acm. |
#include <iostream>
#include <string>
using namespace std;
int main()
{
char str[1001];
int i = 0, n,lower = 0,upper = 0,len;
cin>>n;
getchar();
while(n--)
{
gets(str);
len = strlen(str);
for(i = 0; i < len; i++)
{
lower = i;
while(str[i]!=' ' && str[i]!='\n')
i++;
upper = i - 1;
for(; upper >= lower; upper--)
printf("%c",str[upper]);
if(str[i]==' ')
printf(" ");
}
printf("\n");
}
return 0;
}
哪里错了呢????求解释。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。