Oct 26, 2021
Is outdated. Because at the end, when the loop ends, the true values are not updated because currlength will be greater than length. Consequently, begin and length are not updated by the if loop as you've presumed but the values are instead stored in index & currlength.
In python, `s[index:index+curr_len]` this worked for me.