• <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 歲月流逝 閱讀(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;
            }

            只有注冊用戶登錄后才能發(fā)表評論。
            網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


            久久精品天天中文字幕人妻| 日韩电影久久久被窝网| 欧美日韩精品久久久久| 久久久噜噜噜www成人网| 久久免费小视频| 久久大香萑太香蕉av| 99久久精品费精品国产一区二区| 99国内精品久久久久久久| 亚洲精品无码专区久久同性男| 久久精品无码一区二区WWW| 久久99毛片免费观看不卡| 国产精品亚洲综合久久| 国产精品美女久久久| 久久久黄色大片| 久久久久久国产精品无码下载| 色综合久久久久综合体桃花网| 久久精品国产精品亚洲| 国产91久久精品一区二区| 久久精品国产亚洲AV久| 国产精品xxxx国产喷水亚洲国产精品无码久久一区 | 久久99精品国产麻豆| 亚洲国产日韩欧美综合久久| 国产精品成人99久久久久91gav| 久久久久久亚洲精品成人| 亚洲精品无码久久久| 久久97久久97精品免视看秋霞| 久久精品人人做人人爽电影| 久久亚洲AV成人无码国产| 中文字幕精品久久| 日日狠狠久久偷偷色综合0| 国产精品美女久久久久av爽| 94久久国产乱子伦精品免费 | 精品国产综合区久久久久久| 2020久久精品国产免费| 国内精品伊人久久久久777| 综合久久国产九一剧情麻豆| 中文字幕日本人妻久久久免费 | 亚洲AV日韩AV永久无码久久| 2019久久久高清456| 国产亚洲精品久久久久秋霞| 国内精品综合久久久40p|