Help Please, Lexicographically Largest Palindromic Subsequence

Guys , I dont know how to solve this problem Problem - 202A - Codeforces can you give me best approach how to solve it.

So the approach i follwed is i use a map and store character againnst the no. of times it appear in the string ,then i form a string as followes. The largest letter that appear times no of times it appear, will give you the answer. If you still have doubt please ask me . HERE IS MY CODE.