my-solutions/codeforces/round-923/task-b/main.cpp

41 lines
726 B
C++

#include <iostream>
using namespace std;
string alph = "abcdefghijklmnopqrstuvwxyz";
int main() {
int t;
cin >> t;
int used_chars[26];
for (int k = 0; k < t; k++) {
int n;
cin >> n;
int* s = new int[n];
for (int i = 0; i < n; i++) {
cin >> s[i];
}
for (int i = 0; i < 26; i++) {
used_chars[i] = 0;
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < 26; j++) {
if (used_chars[j] == s[i]) {
cout << alph[j];
used_chars[j]++;
break;
}
}
}
cout << endl;
delete[] s;
}
}