Also slightly shorter:
while word[S:]: pIndex, word = (pIndex + 1) % len(C), word[1:] + C[pIndex] * (word[0] == "1")
while word[S:]: pIndex, word = (pIndex + 1) % len(C), word[1:] + C[pIndex] * int(word[0])
Also slightly shorter:
Or, even shorter, And obviously one can just use one letter variable names/remove whitespace.