>>> apply_table("0123456789", list(range(10))) '9012345678' >>> apply_table("0123456789", list(range(9, -1, -1))) '8765432109'
(inp, table)
| 1 | def apply_table(inp, table): |
| 2 | """ |
| 3 | >>> apply_table("0123456789", list(range(10))) |
| 4 | '9012345678' |
| 5 | >>> apply_table("0123456789", list(range(9, -1, -1))) |
| 6 | '8765432109' |
| 7 | """ |
| 8 | res = "" |
| 9 | for i in table: |
| 10 | res += inp[i - 1] |
| 11 | return res |
| 12 | |
| 13 | |
| 14 | def left_shift(data): |