Gym - 100187L

题目:

Statements

Andrey works in the Ministry of Truth. His work is changing articles in newspapers and magazines so that they praise the Party and Big Brother.

Recently Big Brother decided that it would be fine if all words in all articles are read equally both from right to left and from left to right. In his opinion it will greatly simplify the reading of articles — even if the word is read in the reverse order, its sense won't change.

Andrey spends one second to erase one letter from the word and write another one to its place. Only one word left to be changed, after that he will complete the plan and be able to go home. Of course, he wants to do it as soon as possible. But the truth is that he does not clearly understand right now which word he should get after the replacement. Help him to find it out.

Input

Input contains a single line with the word that Andrey has to change. The word consists of lowercase Latin letters and its length is from 1 to 200000, inclusively.

Output

Output the word which should be a result of Andrey's work. If there are several possible such words, output any of them.

Examples

Input

abccabd

Output

abacaba

Input

wasitadogoracatiate

Output

wasitacaroracatisaw

输出回文串,刚开始没有看到,  If there are several possible such words, output any of them.一直做不出来,最后问了队里的小姐姐,才恍然大悟。

先顺序输出到(n+1)/2,再从n/2-1逆序输出。

#include <iostream>
#include <stdio.h>
#include <string.h>
#define maxn 200010
using namespace std;

int main()
{
    char str[maxn];
    while(scanf("%s",str)!= EOF)
    {
        int n = strlen(str);
        for(int i = 0;i < (n+1)/2;i ++)
            printf("%c",str[i]);
        for(int i = n/2-1;i>=0;i --)
            printf("%c",str[i]);
        printf("\n");
    }
    return 0;
}

 

阅读更多
想对作者说点什么?

博主推荐

换一批

没有更多推荐了,返回首页