CF1085A.Right-Left Cipher

入门

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Polycarp loves ciphers. He has invented his own cipher called Right-Left.

Right-Left cipher is used for strings. To encrypt the string s=s1s2…sns=s_{1}s_{2} \dots s_{n} Polycarp uses the following algorithm:

  • he writes down s1s_1,
  • he appends the current word with s2s_2 (i.e. writes down s2s_2 to the right of the current result),
  • he prepends the current word with s3s_3 (i.e. writes down s3s_3 to the left of the current result),
  • he appends the current word with s4s_4 (i.e. writes down s4s_4 to the right of the current result),
  • he prepends the current word with s5s_5 (i.e. writes down s5s_5 to the left of the current result),
  • and so on for each position until the end of ss.

For example, if ss="techno" the process is: "t" →\to "te" →\to "cte" →\to "cteh" →\to "ncteh" →\to "ncteho". So the encrypted ss="techno" is "ncteho".

Given string tt — the result of encryption of some string ss. Your task is to decrypt it, i.e. find the string ss.

波利卡普喜欢密码。他发明了一种名为“右-左”的自创密码。

“右-左”密码用于字符串。为加密字符串 s=s1s2…sns=s_{1}s_{2} \dots s_{n},波利卡普使用如下算法:

  • 他先写下 s1s_1;
  • 然后将 s2s_2 追加到当前字符串的右侧(即在当前结果的右边写下 s2s_2);
  • 接着将 s3s_3 添加到当前字符串的左侧(即在当前结果的左边写下 s3s_3);
  • 再将 s4s_4 追加到当前字符串的右侧(即在当前结果的右边写下 s4s_4);
  • 再将 s5s_5 添加到当前字符串的左侧(即在当前结果的左边写下 s5s_5);
  • 依此类推,对 ss 中每个字符依次执行该操作,直至处理完所有字符。

例如,若 ss = "techno",则加密过程为:
"t" →\to "te" →\to "cte" →\to "cteh" →\to "ncteh" →\to "ncteho"。
因此,字符串 ss = "techno" 的加密结果为 "ncteho"。

现给定字符串 tt —— 它是某个字符串 ss 经上述加密后得到的结果。你的任务是解密 tt,即找出原始字符串 ss。

输入格式

The only line of the input contains tt — the result of encryption of some string ss. It contains only lowercase Latin letters. The length of tt is between 11 and 5050, inclusive.

输入仅包含一行,即字符串 ss 加密后的结果 tt。tt 仅由小写拉丁字母组成,其长度在 11 到 5050 之间(含端点)。

输出格式

Print such string ss that after encryption it equals tt.

输出满足加密后等于 tt 的字符串 ss。

输入输出样例

  • 输入#1

    ncteho

    输出#1

    techno
  • 输入#2

    erfdcoeocs

    输出#2

    codeforces
  • 输入#3

    z

    输出#3

    z

输入解题思路,AI测评打分。不知道怎么写?

首页