Longest running string
You should keep 4 variables:


The start index of the longest run
The end index (or length) of the longest run
The start index of the current run
The iterating index


For performance, you'd likely also store the char of the current run in a variable.

When done iterating, return substring of longest run.