
When fixing the trailing newline issue, I overlooked the fact that subsequence's second index is exclusive, not inclusive, so it's i<=len not i<len.
When fixing the trailing newline issue, I overlooked the fact that subsequence's second index is exclusive, not inclusive, so it's i<=len not i<len.