#include #include #include int main() { // Read the input int N; std::cin >> N; std::string S; std::cin >> S; std::vector P(N); for (int i = 0; i < N; ++i) { std::cin >> P[i]; } // Create the output string T std::string T(N, ' '); // Initialize T with N spaces for (int i = 0; i < N; ++i) { T[i] = S[P[i] - 1]; // Rearrange characters based on permutation } // Output the result std::cout << T << std::endl; return 0; }