Travelfusion interview question

return longest substring with same continous characters only using a single loop