one_two¶
Given a string, compute a new string by moving the first char to come after the next two chars, so “abc” yields “bca”. Repeat this process for each subsequent group of 3 chars, so “abcdef” yields “bcaefd”. Ignore any group of fewer than 3 chars at the end.
This exercise was taken from codingbat.com and has been adapted for the Python language. There are many great programming exercises there, but the majority are created for Java.
Test 14¶
Input:
'abcdefghijklkmnopqrstuvwxyz1234567890'
Output:
'bcaefdhigkljmnkpqostrvwuyzx231564897'
Test 15¶
Input:
'abcdefghijklkmnopqrstuvwxyz123456789'
Output:
'bcaefdhigkljmnkpqostrvwuyzx231564897'