#316. 字符串三字符重排
字符串三字符重排
String Three-Character Rearrangement
Background
Congcong has recently been studying string transformations. He discovered an interesting rearrangement rule and wants your help to implement it.
Problem Description
Given a string, compute a new string by moving the first character to come after the next two characters, so "abc" yields "bca". Repeat this process for each subsequent group of 3 characters, so "abcdef" yields "bcaefd". Ignore any group of fewer than 3 characters at the end.
Input Format
Input is given from Standard Input in the following format.
A string .
Output Format
Output is printed to Standard Output in the following format.
The rearranged string.
Sample
abc
bca
tca
cat
tcagdo
catdog
Sample Explanation
For the first sample, the first character 'a' of "abc" is moved after 'b' and 'c', resulting in "bca". For the third sample, the string "tcagdo" can be divided into two groups: "tca" and "gdo". "tca" becomes "cat". "gdo" becomes "dog". The final result is "catdog".
Constraints
Time limit: 1 second, Memory limit: 1024 KiB for each test case.