#include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
string sortString(string s) {
vector<int> freq(26, 0);
for(char c: s) freq[c - 'a'] ++;
string res = "";
while(res.size() != s.size()){
for(int i = 0; i < 26; i ++)
if(freq[i]) res += ('a' + i), freq[i] --;
for(int i = 25; i >= 0; i --)
if(freq[i]) res += ('a' + i), freq[i] --;
}
return res;
}
};
int main() {
return 0;
}