• <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精品久久久久久动态图 | 93精91精品国产综合久久香蕉 | 久久精品一区二区影院| 久久99精品久久久久久9蜜桃| 9191精品国产免费久久| 伊人久久精品影院| 久久精品国产亚洲AV无码娇色 | 国产一区二区三区久久精品| 青青草国产成人久久91网| 欧美大战日韩91综合一区婷婷久久青草| 香蕉久久夜色精品国产尤物| 人妻精品久久无码区| 精品久久久久久无码免费| 久久久久久精品免费看SSS| 久久电影网一区| 久久久久高潮综合影院| 韩国三级中文字幕hd久久精品| 国产精品久久久久蜜芽| 久久精品这里热有精品| 狠狠色婷婷久久综合频道日韩| 久久国产一区二区| 国内精品久久久久久久久电影网 | 久久精品中文字幕第23页| 色88久久久久高潮综合影院| 久久久精品波多野结衣| 精品久久久久久中文字幕| 久久午夜夜伦鲁鲁片免费无码影视| 久久青草国产精品一区| 国产精品99久久免费观看| 一本色道久久88综合日韩精品 | 亚洲国产综合久久天堂| 亚洲国产精品久久久久婷婷软件| 亚洲中文久久精品无码| 久久精品视频一| 天堂无码久久综合东京热| 久久久久久国产a免费观看不卡| 久久99精品国产麻豆宅宅| 久久久久亚洲av无码专区喷水 | 午夜精品久久久久久99热| 日本欧美国产精品第一页久久| 国产一区二区精品久久凹凸|