longest substring in which the number of occurrences of each letter is equal