Uber interview question

Longest repeating sequence with replacement