• <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
               :: 首頁 :: 新隨筆 :: 聯(lián)系 ::  :: 管理

            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;
            }

            只有注冊用戶登錄后才能發(fā)表評論。
            網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


            国产成年无码久久久久毛片| 久久香综合精品久久伊人| 国产综合成人久久大片91| 91精品国产综合久久四虎久久无码一级| 国产精品美女久久久m| 99久久国产主播综合精品 | segui久久国产精品| 久久综合久久综合亚洲| 久久99精品久久久久久动态图 | 国产精品久久新婚兰兰| 久久精品国产亚洲AV高清热| 办公室久久精品| 亚洲愉拍99热成人精品热久久| 久久99国产精品99久久| 久久国产AVJUST麻豆| 久久精品国产亚洲网站| 亚洲精品无码久久一线| 精品无码人妻久久久久久| 午夜精品久久久久久中宇| 久久久久国色AV免费观看| 久久久精品国产sm调教网站| 日韩AV毛片精品久久久| 9久久9久久精品| 欧美丰满熟妇BBB久久久| 国产精品美女久久福利网站| 久久久久久久久久久免费精品| 77777亚洲午夜久久多喷| 亚洲国产另类久久久精品小说 | 99久久国产热无码精品免费久久久久| 欧美日韩精品久久久久| 久久精品国产精品亚洲人人| 久久91精品国产91久久麻豆| 久久w5ww成w人免费| 亚洲级αV无码毛片久久精品| 久久久人妻精品无码一区| 97超级碰碰碰碰久久久久| 国产高潮国产高潮久久久91| 青青青国产成人久久111网站| 99久久精品费精品国产一区二区 | 麻豆国内精品久久久久久| 看全色黄大色大片免费久久久|