This question has language restriction and can only be submitted in JAVA.
Arun has Many dresses in his almirah. He has to go on a trip but he can only choose two of them. each dress is denoted here by lower case alphabet.
He is given the sequence of dresses denoted by a string S.
His goal is to create the longest possible sequence by S, that consist just two alternating dresses.
Arun can remove dresses until the sequence is made up of any two alternating dresses. when he choose a dress to remove, all instances of that dress must be removed. For example, if the sequence S is beabeefeab and if he remove dress e then the sequence reduces to babfab
Output the length of the longest alternating sequence which can be made by following the above rules.
If no such alternating sequence is possible then output 0.
Input Format
The first line contains a single integer denoting the length of the sequence.
The second line contains the sequence.
Constraints
1<= |S| <=100
a<= S[i] <=z
Output Format
Print a single integer denoting length of longest alternating sequence.
babab is the longest alternating sequence which can be made by removing e and f.