#include #include using namespace std; struct str { int c; char ch; }; bool operator<(str a, str b) { if(a.c == b.c) return a.ch > b.ch; return a.c > b.c; } int main() { ifstream fin("symbol.in"); ofstream fout("symbol.out"); priority_queue temp; for(int i = 0; i < 5; i ++) { int a; char b; fin >> a >> b; str tmp; tmp.c = a; tmp.ch = b; temp.push(tmp); } while(!temp.empty()) { for(int i = 0; i < temp.top().c; i ++) { fout << temp.top().ch; } fout << endl; temp.pop(); } }