the problem is reduced to finding longset repeated characters