string: forgot if we don't have an occurence but the first character of tsub matches string[i] case, started adding comments
main: add \n\na to start and end of original to verify that the algorithm works at both start and end of string; string: add comments and do some small tweaks to the algorithm, remove copious output.