← 返回 capitalone 的题目列表Reorder a String by Alternating Ends
类型:online_judge
Given a string s, reorder its characters by taking characters alternately from the beginning and the end of the original string:
Take the first character.
Take the last character.
Take the second character.
Take the second-to-last character.
Continue until every character has been used.
Return the reordered string.
Input Format
One line containing string s.
Output Format
Print the reordered string.
Constraints
1 <= len(s) <= 2 * 10^5
s may contain any non-newline characters.
Example
Input:
abcde
Output:
aebdc
Example
Input
abcde
Output
aebdc