append character ( ' a ' + i ) in resultant string ' result ' by min ( count1 [ i ] , count2i ] ) times
for ( int j = 1 ; j <= min ( count1 [ i ] , count2 [ i ] ) ; j ++ ) result . push_back ( ' a ' + i ) ; cout << result ; }