#include <iostream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <iterator>
#include <functional>
#include <complex>
#include <queue>
#include <stack>
#include <cmath>
#include <cassert>
#include <tuple>
using namespace std;
typedef long long LL;
typedef complex<double> CMP;

class HappyLetterDiv1 { public:
	string getHappyLetters(string letters)
	{
		set<char> cs(letters.begin(), letters.end());
		string ans;
		for(char c: cs)
			if(can_win(c, letters))
				ans += c;
		return ans;
	}

	bool can_win(char c, const string& s)
	{
		string rest;
		string cs;
		for(char ch: s) (ch==c ? cs : rest) += ch;

		if(rest.size()%2==1) {
			rest += c;
			cs.resize(cs.size()-1);
		}

		while(!cs.empty()) {
			if(can_erase(rest))
				return true;
			if(cs.size()<2)
				break;
			rest += string(2, c);
			cs.resize(cs.size()-2);
		}
		return false;
	}

	bool can_erase(string s)
	{
		map<char, int> cnt;
		int maxCnt = 0;
		for(char c: s) maxCnt = max(maxCnt, ++cnt[c]);
		return maxCnt*2 <= s.size();
	}
};

// BEGIN CUT HERE
#include <ctime>
double start_time; string timer()
 { ostringstream os; os << " (" << int((clock()-start_time)/CLOCKS_PER_SEC*1000) << " msec)"; return os.str(); }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v)
 { os << "{ ";
   for(typename vector<T>::const_iterator it=v.begin(); it!=v.end(); ++it)
   os << '\"' << *it << '\"' << (it+1==v.end() ? "" : ", "); os << " }"; return os; }
void verify_case(const string& Expected, const string& Received) {
 bool ok = (Expected == Received);
 if(ok) cerr << "PASSED" << timer() << endl;  else { cerr << "FAILED" << timer() << endl;
 cerr << "\to: \"" << Expected << '\"' << endl << "\tx: \"" << Received << '\"' << endl; } }
#define CASE(N) {cerr << "Test Case #" << N << "..." << flush; start_time=clock();
#define END	 verify_case(_, HappyLetterDiv1().getHappyLetters(letters));}
int main(){

CASE(0)
	string letters = "aabbacccc"; 
	string _ = "abc"; 
END
CASE(1)
	string letters = "aaaaaaaccdd"; 
	string _ = "a"; 
END
CASE(2)
	string letters = "ddabccadb"; 
	string _ = "abcd"; 
END
CASE(3)
	string letters = "aaabbb"; 
	string _ = ""; 
END
CASE(4)
	string letters = "rdokcogscosn"; 
	string _ = "cos"; 
END
/*
CASE(5)
	string letters = ; 
	string _ = ; 
END
CASE(6)
	string letters = ; 
	string _ = ; 
END
*/
}
// END CUT HERE
