HDU 1062

来源:互联网 发布:java bloomfilter原理 编辑:程序博客网 时间:2024/06/01 08:26

#include<stdio.h>#include<string.h>char str[1001],temp[101],*p;int main(){    int n,i,j;    scanf("%d",&n);    getchar();    while(n--)    {        memset(str,0,sizeof(str));        gets(str);        p = str;        i = 1;        while(*p!='\0')        {            if(*p!=' ')            {                temp[i++] = *p;                if(*(p+1)==' ')                    temp[0] = ' ';            }            else            {                for(j = i -1;j >= 0;j  --)                    printf("%c",temp[j]);                    i = 1;            }            if(*(p+1)=='\0')            {                    for(j = i -1;j >0;j  --)                    printf("%c",temp[j]);            }            p++;        }      printf("\n");    }    return 0;}


0 0
原创粉丝点击