Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main()
- {
- int n;
- cin>>n;
- vector<string> s(n);
- for(auto &e: s)
- cin>>e;
- vector<pair<int, int>> v;
- for(int i=0; i<n; i++)
- {
- int c = 0;
- for(auto e: s[i])
- c += (e == 'x');
- v.push_back({c, i+1});
- }
- sort(v.begin(), v.end());
- for(auto [a, b]: v)
- cout<<b<<" ";
- cout<<"\n";
- }
Advertisement
Add Comment
Please, Sign In to add comment