The function is given three parameters:
"alphabet" a string of 26 lower-case letter,"s" a string of lower-case letters to be encoded,shifts a list of integers of the same length as "s".To encode the string one has to perform n rounds (the length of "s"):
s[0] by shifts[0] amount according to the "alphabet". The shift is circular, i.e. for ordinary alphabet and shift == 1 "z" -> "a" is applied.new s[0], s[1] by shifts[1] amount.new, new s[0], new s[1], s[2] by shifts[2] amount.n-th round – shift all letters by shift[n-1] amount according to the "alphabet".Return the encoded string of the same length as s.
shift_chars("abcdefghijklmnopqrstuvwxyz", "abc", [1, 1, 1]) ➞ "ddd"
# a is shifted by 3 to d
# b is shifted by 2 to d
# c is shifted by 1 to d
shift_chars("adbecfghijklmnopqrstuvwxyz", "abc", [1, 1, 1]) ➞ "ecf"
# a is shifted by 3 to e
# b is shifted by 2 to c
# c is shifted by 1 to f
shift_chars("abcdefghijklmnopqrstuvwxyz", "yywygs", [1, 1, 1, 1, 1, 1]) ➞ "innokodakademija"
# y is shifted by 6 to e. Notice circular shift.
# y is shifted by 5 to d. Notice circular shift.
# w is shifted by 4 to a. Notice circular shift.
# y is shifted by 3 to b. Notice circular shift.
# g is shifted by 2 to i
# s is shifted by 1 to t
shift_chars('vortlxngidwmpzakebhcsjufqy', 'dmhmv', [5, 2, 3, 4, 1]) ➞ "qjveo"
# d is shifted by 15 to q
# m is shifted by 10 to j
# h is shifted by 8 to v. Notice circular shift.
# m is shifted by 5 to e
# v is shifted by 1 to o
N/A