• <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 歲月流逝 閱讀(899) 評論(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;
            }
            91精品国产高清久久久久久91| 免费一级做a爰片久久毛片潮| 亚洲国产精品久久久天堂| 99久久精品免费看国产一区二区三区| 久久久久亚洲AV片无码下载蜜桃| 亚洲欧美日韩久久精品第一区| 久久精品成人免费看| 日韩精品无码久久一区二区三| 无码伊人66久久大杳蕉网站谷歌| 久久99国产精品久久99| 久久久久久久免费视频| 久久国产精品一国产精品金尊| 久久精品国产只有精品66| 一本色道久久99一综合| 国产免费久久精品丫丫| 国色天香久久久久久久小说| 91久久精品国产成人久久| 久久影院综合精品| 久久综合色区| 久久99热国产这有精品| 久久无码人妻一区二区三区| 亚洲色欲久久久久综合网 | 欧美日韩精品久久久久| 久久成人影院精品777| 亚洲国产另类久久久精品黑人| 久久久久久亚洲精品无码| 狠狠色丁香久久综合婷婷| 日产精品99久久久久久| 国产激情久久久久久熟女老人 | 久久久久久久综合日本亚洲| 狠狠色婷婷久久综合频道日韩| 久久精品国产精品亚洲艾草网美妙| 久久国产色AV免费看| 日韩精品久久无码人妻中文字幕 | 欧美午夜A∨大片久久| 久久九九久精品国产免费直播| 热久久这里只有精品| 91精品无码久久久久久五月天| 国产AⅤ精品一区二区三区久久| 久久精品免费观看| 99久久精品国产一区二区蜜芽|