• <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;
            }
            午夜精品久久久久久影视riav| 久久精品国产亚洲AV蜜臀色欲 | 久久九九久精品国产免费直播| 成人亚洲欧美久久久久| 精品99久久aaa一级毛片| 99久久香蕉国产线看观香| av午夜福利一片免费看久久| 99久久99久久精品国产片| 99久久综合国产精品免费| 欧美777精品久久久久网| 午夜精品久久久久久毛片| 久久亚洲高清观看| 久久久久久久波多野结衣高潮 | 久久精品中文字幕一区| 精品国产乱码久久久久久1区2区| 久久99亚洲综合精品首页| 韩国免费A级毛片久久| 亚洲&#228;v永久无码精品天堂久久 | 日产精品久久久久久久| 久久高潮一级毛片免费| 久久精品国产99国产电影网| 久久天天躁狠狠躁夜夜avapp | 久久久久久国产精品无码下载| 国产亚洲精久久久久久无码AV| 精品久久久久久无码专区| 久久AV无码精品人妻糸列| 亚洲乱码日产精品a级毛片久久| 色综合色天天久久婷婷基地| 久久人人爽人人爽人人AV| 亚洲精品无码专区久久同性男| 久久精品国产黑森林| 日本一区精品久久久久影院| 91精品国产乱码久久久久久 | 国产精品美女久久久久AV福利| 久久99中文字幕久久| 久久精品国产精品亚洲精品 | 99久久成人国产精品免费| 国产精品美女久久久m| 亚洲午夜无码久久久久小说| 亚洲一本综合久久| 伊人久久免费视频|