Dexter is creating secret codes. He does this using a specialseries and a magic string. Given the n, he selects the all the s(i)characters of the magic string, where s(i) are the first n elementsof the special series.
This is how the special series is defined:
s(0) = 1s(1) = 1s(2) = 1s(n) = s(n-2) + s(n-3) (for n>2)
Example, for n = 5, and magic_string as abcdefgh. Dexter selectsthe characters at positions: 1 1 1 2 2. Thus the encoded string is:bbbcc.
Given n and magic_string, you have to print the encodedstring.
Give the programming code in python.