// sortStack runs for each of the n elements. // Each call pops one element and eventually reinserts it. // insert in the worst case may traverse the entire current stack to find the right place for ...
string v="aeiouAEIOU"; int l=0,r=s.size()-1; while (l<r){ while (l<r && v.find(s[l])==string::npos) l++; while (l<r && v.find(s[r])==string::npos) r--; ...