Back
Close

Rotating Binary Encryption

Statement

 Goal

Take an array (N) of words. Let each character within the words be converted into ASCII, then binary, and then place them back in the same array. Swap each left with the right within the array. Iterate through the list and swap the binaries left with the right until the second to last number (-2 index), with a stride of 2. To make it easy, only an even length of N words will be used. Print each octet on a separate line.
Input
Line 1: integer N
Line 2: a list of N words each of length N
Output
Line of binary numbers, one per line
Constraints
0 < N < 10
Example
Input
Are you ready to rock player1?
Output
1111001
1110111
1101011
100001
1101100
1100011
1101010
1110111
1101100
1100011
1100001
1100010
1111001
1101000
1110010
1100001
1111001
1100011
1101100
110010
111111
1101100
1110111
1100101
1110101

Game modes
Fastest, Shortest

Test cases
Test 1 Test
Input
Are you ready to rock player1?
Output
1111001 1110111 1101011 100001 1101100 1100011 1101010 1110111 1101100 1100011 1100001 1100010 1111001 1101000 1110010 1100001 1111001 1100011 1101100 110010 111111 1101100 1110111 1100101 1110101

Validator 1 Validator
Input
Are you ready to rock player1?
Output
1111001 1110111 1101011 100001 1101100 1100011 1101010 1110111 1101100 1100011 1100001 1100010 1111001 1101000 1110010 1100001 1111001 1100011 1101100 110010 111111 1101100 1110111 1100101 1110101

Test 2 Test
Input
Rock and roll all night long
Output
1100001 1110110 1100010 101100 1110111 1100101 1110101 1100001 1110010 1110010 1101100 1110111 1110010 1110010 1110010 1110111 1110110 1100111 1110110 1110001 1100111 1110000 1101010

Validator 2 Validator
Input
Rock and roll all night long
Output
1100001 1110110 1100010 101100 1110111 1100101 1110101 1100001 1110010 1110010 1101100 1110111 1110010 1110010 1110010 1110111 1110110 1100111 1110110 1110001 1100111 1110000 1101010

Test 3 Test
Input
Born in the USA
Output
1110001 1110110 100100 1110111 1101100 1110110 101011 101101 100001 1101010 1110000 1100011

Validator 3 Validator
Input
Born in the USA
Output
1110001 1110110 100100 1110111 1101100 1110110 101011 101101 100001 1101010 1110000 1100011

Test 4 Test
Input
Binary analysis is fun!
Output
1100001 1110110 1100001 1110010 1111001 1101101 1110001 1101101 100100 1110001 1110110 1100001 1101100 1111001 1100110 1101011 1110110 10010 1110001 1101101

Validator 4 Validator
Input
Binary analysis is fun!
Output
1100001 1110110 1100001 1110010 1111001 1101101 1110001 1101101 100100 1110001 1110110 1100001 1101100 1111001 1100110 1101011 1110110 10010 1110001 1101101

Solution language

Solution

Stub generator input