Just some testing, imagine that in one letter of the string you have āaā, so the index will be 0. Applying alpha[(ind + 13) % 26] will result in alpha[(0+13) % 26]

0 + 13 = 13
13 % 26 = 13 (remainder)

Now imagine we got the letter āzā in the string, so the index will be 25 (26 0-indexed). In this case we have:

25 + 13 = 38
38 % 26 = 12 (remainder and perfect position)
// That's because we need to start again
// once we get to the end