Loop to find the frequencies subsequence of length 2
for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i + 1 ; j < n ; j ++ ) { string temp = " " ; temp += s [ i ] ; temp += s [ j ] ; freq [ temp ] ++ ; } } int answer = INT_MIN ;