Try Again

玲珑学院 1127 咸鱼文章

1127 - 咸鱼文章

Time Limit:1s Memory Limit:128MByte

Submissions:474Solved:196

DESCRIPTION

elttiL moT nwod eht teerts sllac ruo god " ehT peek god " . piZ si a peehs god . tuB nehw moT seirt ot yas " peeS " , ti semoc tuo " peek " . dnA ni a yaw moT si thgir . piZ si syawla gnignirb sgniht oh rof su ot peek ! ll'I llet uoy tuoba emos fo meht .
s'piZ tsrif tneserp saw a eohs . tI saw edam fo neerg klis .
eW t'ndid wonk woh piZ dnuof eht eohs . tuB retfa a tnemom yraM , ym gib retsis , dlot em eht eohs dah a egnarts llems . I deddon dna dleh ym eson . " tahW od uoy kniht ti si ? "
" tI sllems ekil gnihtemos rof gninaelc . I kniht enoemos deirt ot naelc a tops ffo eht eohs . nehT eh tup ti ta eht rood ot yrd . "
" gnolA emac piZ . dnA eyb-doog eohs ! " I dias . " eW dluohs ekat ti kcab . "
" eW t'nac " . dias ym rettsis .
" ebyaM elttil moT si thgir , " yraM dias . " ebyaM piZ si a peek god ! "

你正在做英语阅读,可哪知这是一篇咸鱼文章,整个文章的所有单词都是翻转的,你很慌。

不过你是咸鱼程序员,你可以写代码将这篇文章翻转回来,那么翻转回来吧。

INPUT
输入一篇英文文章。 输入数据中只包含空格、换行符和小写大写字母。 满足总字数小于等于100000
OUTPUT
你应该把这个文章的所有单词都翻转回来,输出即可。
SAMPLE INPUT
AAA BBB AB AB
SAMPLE OUTPUT
AAA BBB BA BA
注意格式,不要多输出空行
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <queue>
#include <cmath>
#include <ctime>
#include <map>
#include <set>
using namespace std;
#define lowbit(x) (x&(-x))
#define max(x,y) (x>y?x:y)
#define min(x,y) (x<y?x:y)
#define MAX 100000000000000000
#define MOD 1000000007
#define pi acos(-1.0)
#define ei exp(1)
#define PI 3.141592653589793238462
#define INF 0x3f3f3f3f3f
#define mem(a) (memset(a,0,sizeof(a)))
typedef long long ll;
vector<string>v;
char ch;
int main()
{
    string s,ss;
    while((ch=getchar())!=EOF)
    {
        if((ch>='a' && ch<='z') || (ch>='A' && ch<='Z'))
            s+=ch;
        else
        {
            if(s.size()>0)
            {
                reverse(s.begin(),s.end());
                v.push_back(s);
                s="";
            }
            ss+=ch;
            v.push_back(ss);
            ss="";
        }
    }
    for(vector<string>::iterator it=v.begin();it!=v.end();it++)
    {
        cout<<*it;
    }
    return 0;
}

 

posted @ 2017-07-21 20:19  十年换你一句好久不见  阅读(283)  评论(0编辑  收藏  举报