
ZOJ Problem Set  1042
Weird Wally's Wireless Widgets, Inc. manufactures an eclectic assortment of
small, wireless, network capable devices, ranging from dog collars, to pencils,
to fishing bobbers. All these devices have very small memories. Encryption algorithms
like Rijndael, the candidate for the Advanced Encryption Standard (AES) are
demonstrably secure but they don't fit in such a tiny memory. In order to provide
some security for transmissions to and from the devices, WWWW uses the following
algorithm, which you are to implement.
Looking at all the letters in the group [ai] we see {i,c,b,f,h,e} appear at positions {2,3,7,8,11,17} within the encrypted message. After a right rotation of k1=2, these positions contain the letters {h,e,i,c,b,f}. The table below shows the intermediate strings that come from doing all the rotations in the first group, then all rotations in the second group, then all the rotations in the third group. Rotating letters in one group will not change any letters in any of the other groups.
All input strings contain only lowercase letters and underscores(_).
Each string will be at most 80 characters long. The ki are all positive integers
in the range 1100. Example input:
Source: MidCentral USA 2001 