#A. Right-Left Cipher

    Type: RemoteJudge 1000ms 256MiB

Right-Left Cipher

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

Right-Left Cipher

题面翻译

题目描述

Polycarp喜欢密码。 他发明了自己的密码,称为“右-左”(?应该是这个意思吧?)。

“右-左”密码用于加密字符串。

Polycarp使用以下算法加密字符串,S=S1S2S3...SnS = S_1S_2S_3 ... S_n:

他写下S1S_1,他用S2S_2接上当前的单词(即将S2S_2写到当前结果的右边),

他在S3S_3前面加上当前的单词(即在当前结果的左边写下S3S_3),

他将S4S_4接上当前单词(即将S4S_4写到当前结果的右侧),

他在S5S_5前面加上当前的单词(即在当前结果的左边写下S5S_5)...

这么做直到处理完SS

举个例子,如果S=S = "techno",那么处理过程就是: "t" → "te" → "cte" → "cteh" → "ncteh" → "ncteho"。所以加密"techno"后的字符串就是"ncteho"。

现在给你一个字符串tt,即加密后的字符串,你的任务就是找到原来的字符串SS

输入输出格式

输入格式:

只有一行,tt,加密后的字符串,只包含小写字母,1<=tlen<=501<= t_{len} <=50

输出格式:

一行,原字符串SS

题目描述

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

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

  • he writes down s1 s_1 ,
  • he appends the current word with s2 s_2 (i.e. writes down s2 s_2 to the right of the current result),
  • he prepends the current word with s3 s_3 (i.e. writes down s3 s_3 to the left of the current result),
  • he appends the current word with s4 s_4 (i.e. writes down s4 s_4 to the right of the current result),
  • he prepends the current word with s5 s_5 (i.e. writes down s5 s_5 to the left of the current result),
  • and so on for each position until the end of s s .

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

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

输入格式

The only line of the input contains t t — the result of encryption of some string s s . It contains only lowercase Latin letters. The length of t t is between 1 1 and 50 50 , inclusive.

输出格式

Print such string s s that after encryption it equals t t .

样例 #1

样例输入 #1

ncteho

样例输出 #1

techno

样例 #2

样例输入 #2

erfdcoeocs

样例输出 #2

codeforces

样例 #3

样例输入 #3

z

样例输出 #3

z

20230225-字符串的应用-随堂测验

Not Attended
Status
Done
Rule
Ledo
Problem
6
Start at
2023-2-25 10:30
End at
2023-2-25 11:30
Duration
1 hour(s)
Host
Partic.
34