Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	io := NewIo()
	defer io.Flush()
	for {
		n := io.NextInt()
		if n == 0 {
			break
		}
		k := make([]int, n)
		for i := 0; i < n; i++ {
			k[i] = io.NextInt()
		}
		const st = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
		s := io.NextLine()
		for i, cnt := 0, 0; i < len(s); i, cnt = i+1, (cnt+1)%n {
			idx := strings.IndexRune(st, rune(s[i]))
			c := st[(idx-k[cnt]+52)%52]
			io.Printf("%c", c)
		}
		io.Println()
	}
}

// I/O template
type Io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

func NewIo() *Io {
	return &Io{
		reader: bufio.NewReader(os.Stdin),
		writer: bufio.NewWriter(os.Stdout),
	}
}

func (io *Io) Flush() {
	err := io.writer.Flush()
	if err != nil {
		panic(err)
	}
}

func (io *Io) NextLine() string {
	var buff []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buff = append(buff, line...)
		if !isPrefix {
			break
		}
	}
	return string(buff)
}

func (io *Io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	s := io.tokens[io.nextToken]
	io.nextToken++
	return s
}

func (io *Io) NextInt() int {
	i, err := strconv.Atoi(io.Next())
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) NextFloat() float64 {
	i, err := strconv.ParseFloat(io.Next(), 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) Println(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}

func (io *Io) Printf(format string, a ...interface{}) {
	fmt.Fprintf(io.writer, format, a...)
}

func (io *Io) PrintIntSlice(a []int) {
	b := make([]interface{}, 0, len(a))
	for _, x := range a {
		b = append(b, x)
	}
	io.Println(b...)
}

func (io *Io) PrintStringSlice(a []string) {
	b := make([]interface{}, 0, len(a))
	for _, x := range a {
		b = append(b, x)
	}
	io.Println(b...)
}

func Log(name string, value interface{}) {
	fmt.Fprintf(os.Stderr, "%s=%+v\n", name, value)
}

func ExampleIo() {
	io := NewIo()
	defer io.Flush()
	a := make([]int, 0, 3)
	a[0], a[1], a[2] = io.NextInt(), io.NextInt(), io.NextInt()
	io.Println(a)
	io.PrintIntSlice(a)
	Log("io", a)
}

C++: #include<iostream>
#include<vector>
#include<string>

using namespace std;
vector<string> ans;
vector<char> alp;

int main(){

	for(int i = 0;i < 26;i++){
		char a = 'a' + i;
		alp.push_back(a);
	}
	for(int i = 0;i < 26;i++){
		char  A = 'A' + i;
		alp.push_back(A);
	}

	while(1){
		int n;
		cin >> n;
		if(n == 0) break;
		int k[100];
		for(int i = 0;i < n;i++) cin >> k[i];
		
		string s;
		cin >> s;
		
		for(int i = 0;i < s.size();i++){
			char cnum;
			if(s[i] >= 'a'){
				cnum = s[i] - 'a';
			}else cnum = s[i] - 'A' + 26;
			s[i] = alp[(cnum -k[i%n] +52)%52];
		}
		
		ans.push_back(s);
	}
	for(int i = 0;i < ans.size();i++)cout << ans[i] << endl;
	return 0;
}

C++: #include <cstdio>

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

int main(){
	for(int n;scanf("%d",&n),n;){
		int k[100];
		rep(i,n) scanf("%d",k+i);
		char s[101]; scanf("%s",s);

		for(int i=0;s[i];i++){
			rep(j,k[i%n]){
				if     (s[i]=='a') s[i]='Z';
				else if(s[i]=='A') s[i]='z';
				else               s[i]--;
			}
		}
		puts(s);
	}

	return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<ll> vl;

ll n;
string s;
ll dic[52];
ll undic[128];


int main(){
  for(ll i = 0;i < 26;i++){
    dic[i] = ('a'+i);
    undic[('a'+i)] = i;
  }
  for(ll i = 0;i < 26;i++){
    dic[i+26] = ('A'+i);
    undic[('A'+i)] = i+26;
  }
  while(cin >> n){
    if(n == 0) return 0;
    vl k = vl(n);
    for(ll i = 0;i < n;i++) cin >> k[i];
    cin >> s;
    string ans;
    for(ll i = 0;i < s.size();i++){
      ll idx = undic[s[i]];
      idx = (idx-k[i%k.size()]+52)%52;
      char c = dic[idx];
      ans.push_back(c);
    }
    cout << ans << endl;

  }
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <string>

#define rep(i, j) for(int i = 0; i < j; i++)
#define all(i) i.begin(), i.end()

using namespace std;

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	vector<char> alp(0);
	for (char c = 'a'; c <= 'z'; c++) { alp.push_back(c); }
	for (char c = 'A'; c <= 'Z'; c++) { alp.push_back(c); }
	int n; while ( cin >> n && n != 0 )
	{
		vector<int> dat(n + 2, 0);
		rep(i, n) { cin >> dat[i]; }
		string str; cin >> str;
		int lp1 = 0, lp2 = 0;
		while (1)
		{
			if (lp1 == n) { lp1 = 0; }
			if (lp2 == (int)str.size()) { break; }
			cout << alp[(find(all(alp), str[lp2]) - alp.begin() - dat[lp1] + alp.size()) % alp.size()];
			lp1++; lp2++;
		}
		cout << "\n";
	}
	return 0;
}

C++: #include <iostream>
#define REP(i, a, n) for(int i = ((int) a); i < ((int) n); i++)
using namespace std;

int N, K[100];
string S;
char st[52];

int main(void) {
  REP(i, 0, 26) st[i] = 'a' + i;
  REP(i, 0, 26) st[i + 26] = 'A' + i;

  while(cin >> N, N) {
    REP(i, 0, N) cin >> K[i];
    cin >> S;

    string ans = "";
    REP(i, 0, S.length()) {
      int code;
      if('a' <= S[i] && S[i] <= 'z') code = S[i] - 'a';
      else code = S[i] - 'A' + 26;
      ans += st[(code - K[i % N] + 52) % 52];
    }
    cout << ans << endl;
  }
}

C++: #include<iostream>
#include<string>
#include<vector>

char calc(char a,int i){
	int b=static_cast<int>(a);
	b-=i;
	if(b<65)b+=58;
	else if(b<97&&b>90)b-=6;
	a=static_cast<char>(b);
	return a;
}

int main(){
	int n;
	std::string str;
	while(std::cin>>n,n){
		std::vector<int> key;
		for(int i=0,a;i<n;i++){
			std::cin>>a;
			key.push_back(a);
		}
		std::cin>>str;
		for(unsigned int i=0;i<str.size();i++){
			if(i>=n)key.push_back(key[i-n]);
			str[i]=calc(str[i],key[i]);
		}
		std::cout<<str<<std::endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define f(i,x,n) for(int i=x;i<(int)(n);++i)
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=200005,INF=1<<30;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    while(1){
        int N;cin>>N;
        if(N==0) break;
        vector<int> A(N);
        for(int i=0;i<N;i++) cin>>A[i];
        string S;cin>>S;
        for(int i=0;i<S.size();i++){
            for(int j=0;j<A[i%N];j++){
                if(S[i]=='a') S[i]='Z';
                else if(S[i]=='A') S[i]='z';
                else S[i]--;
            }
        }
        
        cout<<S<<endl;
    }
}

C++: 
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <stack>
#include <cctype>
#include <complex>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <cassert>

using namespace std;


bool solve(){
	int n;
	cin>> n;
	if(!n) return false;
	vector<int> a(n);
	for(int i=0;i<n;i++){
		cin>> a[i];
	}
	string str;
	cin>> str;
	
	for(int i=0;i<str.size();i++){
		int k = a[i%n];
		char c = str[i];
		if(islower(c)){
			if(islower(c-k)){
				c -= k;
			}else{
				k -= c - 'a';
				c = 'Z' - (k-1);
			}
		}else if(isupper(c)){
			if(isupper(c-k)){
				c -= k;
			}else{
				k -= c - 'A';
				c = 'z' - (k-1);
			}
		}
		cout<< c;
	}
	cout<< endl;

	return true;
}

int main(){
	cout.setf(ios::fixed);
	cout.precision(10);
	while(solve()){}

	return 0;
}