Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <algorithm>
- using namespace std;
- int main()
- {
- int n, m;
- cin >> n >> m;
- string s;
- cin >> s;
- sort(s.rbegin(), s.rend());
- int niza[m];
- for(int i = 0; i < m; i++)
- {
- cin >> niza[i];
- }
- for(int i = 0; i < m; i++)
- {
- cout << s[niza[i]-1] << " ";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement