#abc293a. A - Swap Odd and Even

A - Swap Odd and Even

Score : 100100 points

问题描述

你将得到一个由小写英文字母组成的长度为偶数的字符串 SS。设 S|S| 表示字符串 SS 的长度,SiS_i 表示字符串 SS 中的第 ii 个字符。

按照以下顺序对每个 i=1,2,,S2i = 1, 2, \ldots, \frac{|S|}{2} 执行以下操作,并打印最终的 SS

  • S2i1S_{2i-1}S2iS_{2i} 交换位置。

以上为通义千问 qwen-max 翻译,仅供参考。

Problem Statement

You are given a string SS of even length consisting of lowercase English letters. Let S|S| be the length of SS, and SiS_i be the ii-th character of SS.

Perform the following operation for each i=1,2,,S2i = 1, 2, \ldots, \frac{|S|}{2} in this order, and print the final SS.

  • Swap S2i1S_{2i-1} and S2iS_{2i}.

Constraints

  • SS is a string of even length consisting of lowercase English letters.
  • The length of SS is at most 100100.

Input

The input is given from Standard Input in the following format:

SS

Output

Print the answer.

Sample Input 1

abcdef

Sample Output 1

badcfe

Initially, S=S = abcdef.
Performing the operation for i=1i = 1 swaps S1S_1 and S2S_2, making S=S = bacdef.
Performing the operation for i=2i = 2 swaps S3S_3 and S4S_4, making S=S = badcef.
Performing the operation for i=3i = 3 swaps S5S_5 and S6S_6, making S=S = badcfe.
Thus, badcfe should be printed.

Sample Input 2

aaaa

Sample Output 2

aaaa

Sample Input 3

atcoderbeginnercontest

Sample Output 3

taocedbrgeniencrnoetts

update @ 2024/3/10 12:11:58