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使用以下算法加密字符串,:
他写下,他用接上当前的单词(即将写到当前结果的右边),
他在前面加上当前的单词(即在当前结果的左边写下),
他将接上当前单词(即将写到当前结果的右侧),
他在前面加上当前的单词(即在当前结果的左边写下)...
这么做直到处理完。
举个例子,如果"techno",那么处理过程就是: "t" → "te" → "cte" → "cteh" → "ncteh" → "ncteho"。所以加密"techno"后的字符串就是"ncteho"。
现在给你一个字符串,即加密后的字符串,你的任务就是找到原来的字符串
输入输出格式
输入格式:
只有一行,,加密后的字符串,只包含小写字母,
输出格式:
一行,原字符串。
题目描述
Polycarp loves ciphers. He has invented his own cipher called Right-Left.
Right-Left cipher is used for strings. To encrypt the string Polycarp uses the following algorithm:
- he writes down ,
- he appends the current word with (i.e. writes down to the right of the current result),
- he prepends the current word with (i.e. writes down to the left of the current result),
- he appends the current word with (i.e. writes down to the right of the current result),
- he prepends the current word with (i.e. writes down to the left of the current result),
- and so on for each position until the end of .
For example, if ="techno" the process is: "t" "te" "cte" "cteh" "ncteh" "ncteho". So the encrypted ="techno" is "ncteho".
Given string — the result of encryption of some string . Your task is to decrypt it, i.e. find the string .
输入格式
The only line of the input contains — the result of encryption of some string . It contains only lowercase Latin letters. The length of is between and , inclusive.
输出格式
Print such string that after encryption it equals .
样例 #1
样例输入 #1
ncteho
样例输出 #1
techno
样例 #2
样例输入 #2
erfdcoeocs
样例输出 #2
codeforces
样例 #3
样例输入 #3
z
样例输出 #3
z
20230225-字符串的应用-随堂测验
- 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