• <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;
            }
            yy6080久久| 丰满少妇人妻久久久久久| 欧美久久久久久| 久久婷婷五月综合色高清| 久久香蕉国产线看观看乱码| 久久精品国产只有精品66 | 久久国产精品免费一区二区三区| 91久久精品电影| 色婷婷综合久久久久中文| 亚洲综合婷婷久久| 久久99久久99精品免视看动漫 | 久久久亚洲AV波多野结衣| 国产福利电影一区二区三区,免费久久久久久久精 | 久久强奷乱码老熟女网站| 伊人久久大香线蕉综合网站| 国内精品久久久久影院一蜜桃| 久久久久亚洲精品天堂久久久久久| 久久亚洲精品成人AV| 久久久久久精品免费看SSS| 狠狠色综合久久久久尤物| 成人综合伊人五月婷久久| 无码国内精品久久综合88| 国内精品久久久久| 亚洲va国产va天堂va久久| 久久er国产精品免费观看8| 日韩人妻无码一区二区三区久久| 九九久久精品国产| 国产精品久久久久久久久鸭| 国产精品久久久久久久人人看 | 国产ww久久久久久久久久| 久久久久久精品久久久久| 精品久久久久久无码国产| A狠狠久久蜜臀婷色中文网| 久久久99精品一区二区| 99国产欧美久久久精品蜜芽| 久久中文字幕无码专区| 国产三级观看久久| 88久久精品无码一区二区毛片| 色8久久人人97超碰香蕉987| 久久人人爽人人爽人人片av麻烦| 国产精品亚洲综合专区片高清久久久|