A "0/1 string" is a string in which every character is either 0 or 1. Two operations can be applied to a 0/1 string.
- switch: every
0 becomes 1 and every 1 becomes 0. For example, "100" becomes "011".
- reverse: the string is reversed. For example, "100" becomes "001".
Consider the infinite sequence of 0/1 strings defined below.
- S0 = ""
- S1 = "0"
- S2 = "001"
- S3 = "0010011"
- S4 = "001001100011011"
- ...
- SN = SN−1 + "0" + switch(reverse(SN−1))
googol is 10100. Find the Kth character of Sgoogol. Character positions are counted from 1.