Skip to content

Instantly share code, notes, and snippets.

@r14152
Created September 28, 2021 07:02
Show Gist options
  • Save r14152/c6a17e7b6b2c9fc38ea84a1e9ac6dbeb to your computer and use it in GitHub Desktop.
Save r14152/c6a17e7b6b2c9fc38ea84a1e9ac6dbeb to your computer and use it in GitHub Desktop.
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
int t,i=0;
cin>>t;
while(i<t){
int n;
cin>>n;
string str;
int arr[n+1],j=0;
cin >>str;
int temp[n+1],l=0;
for(int k=0;k<n;k++)
{
temp[l] = str[k]-'a';
l++;
}
while(j<n)
{
cin>>arr[j];
for(int l=0;l<arr[j];l++){
temp[l] +=1;
if(l>25)
break;
if(temp[l]>25)
temp[l]=0;
}
j++;
}
string ptr="";
j=0;
string alphabet = "abcdefghijklmnopqrstuvwxyz";
while(j<n){
ptr +=alphabet[temp[j]];
j++;
}
cout<<ptr<<endl;
i++;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment