• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            posts - 7, comments - 13, trackbacks - 0, articles - 37
               :: 首頁 :: 新隨筆 :: 聯系 ::  :: 管理

            1062 Text Reverse

            Posted on 2008-10-09 19:32 歲月流逝 閱讀(897) 評論(0)  編輯 收藏 引用

            Text Reverse

            Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
            Total Submission(s): 1391    Accepted Submission(s): 577


            Problem Description
            Ignatius likes to write words in reverse way. Given a single line of text which is written by Ignatius, you should reverse all the words and then output them.
             

            Input
            The input contains several test cases. The first line of the input is a single integer T which is the number of test cases. T test cases follow.
            Each test case contains a single line with several words. There will be at most 1000 characters in a line.
             

            Output
            For each test case, you should output the text which is processed.
             

            Sample Input
            3
            olleh !dlrow
            m'I morf .udh
            I ekil .mca
             

            Sample Output
            hello world!
            I'm from hdu.
            I like acm.
            
            Hint
            Remember to use getchar() to read '\n' after the interger T, then you may use gets() to read a line and process it.
             

            Author
            Ignatius.L
             
            #include <stdio.h>
            #include <string.h>
            int main()
            {
                int i=0,n,length,t,j;
                char ch,p[1001],temp;
                scanf("%d",&n);
                ch=getchar();
                while(n--)
                {
                    gets(p);
                    length=strlen(p);
                    t=0;
                    for(i=0;i<=length;i++)
                    {
                        if(p[i]==' '||p[i]=='\0')
                        {
                           for(j=t;j<(i+t)/2;j++)
                        {
                            temp=p[j];
                            p[j]=p[i-j+t-1];
                            p[i-j+t-1]=temp;
                        }
                        t=i+1;
                        }
               
                    }   
                    printf("%s\n",p);
               
                }
                return 0;
            }
            香蕉99久久国产综合精品宅男自 | 国产∨亚洲V天堂无码久久久| 99久久人人爽亚洲精品美女| 7777久久久国产精品消防器材| 久久久精品日本一区二区三区| 99久久人妻无码精品系列| 精品久久亚洲中文无码| 伊人色综合九久久天天蜜桃| 久久精品国产亚洲Aⅴ蜜臀色欲| 欧美亚洲另类久久综合| av午夜福利一片免费看久久| 日韩精品久久无码中文字幕| 国产A级毛片久久久精品毛片| 怡红院日本一道日本久久| 99精品久久精品| 99久久国语露脸精品国产| 久久精品水蜜桃av综合天堂| 亚洲精品乱码久久久久久按摩| 久久亚洲AV无码精品色午夜 | 久久久久久青草大香综合精品| 国产三级观看久久| 久久久WWW成人免费精品| 久久久久成人精品无码| 一本一本久久a久久精品综合麻豆| 久久这里只有精品视频99| 久久精品国产99国产精品| 亚洲日本va午夜中文字幕久久| 一个色综合久久| 午夜天堂精品久久久久| 久久国产色AV免费看| 国产精品久久自在自线观看| 久久综合综合久久97色| 欧美久久久久久精选9999| 久久久SS麻豆欧美国产日韩| 欧美噜噜久久久XXX| 久久婷婷久久一区二区三区| 久久伊人精品青青草原日本| 久久久亚洲欧洲日产国码是AV| 久久久无码人妻精品无码| 国产精品久久久久一区二区三区| 亚洲国产精品综合久久网络 |