Caution:

For $ = 0 to $S + 1 ^ 0

loops in fact to the length of $S + 1
_________________________