• <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 歲月流逝 閱讀(895) 評論(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   管理


            久久青青草原精品国产软件| 亚洲国产精品一区二区久久| 一本大道久久东京热无码AV | 99久久精品国产一区二区蜜芽| 久久99国产精品久久99| 久久福利片| 亚洲AV乱码久久精品蜜桃| 热久久国产精品| 久久久国产视频| 国产成人精品久久亚洲| 亚洲香蕉网久久综合影视| 九九久久99综合一区二区| 亚洲AV伊人久久青青草原| 99久久精品费精品国产一区二区| 久久天天躁狠狠躁夜夜av浪潮| 亚洲精品无码久久久久| 久久精品18| 久久91综合国产91久久精品| 久久国语露脸国产精品电影| 国产精品伊人久久伊人电影| 国产精品美女久久久久| 性做久久久久久久久浪潮| 嫩草影院久久99| 久久久久人妻一区二区三区vr| 香蕉99久久国产综合精品宅男自| 色综合久久天天综合| 久久久久亚洲精品无码蜜桃| 久久人人爽人人人人片av| 精品久久综合1区2区3区激情 | 香蕉久久久久久狠狠色| 国产精品成人99久久久久 | 久久亚洲国产欧洲精品一| 一本一本久久aa综合精品 | 国产叼嘿久久精品久久| 99re久久精品国产首页2020| 人妻精品久久无码专区精东影业| 精品无码久久久久国产动漫3d| 久久综合成人网| 久久久久久久精品妇女99| 久久无码国产专区精品| 亚洲综合熟女久久久30p|