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 <cstdio>
#include <utility>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#define REP(i,n) for(int i=0;i<n;i++)
typedef long long ll;
using namespace std;
typedef vector<ll> vl;
typedef pair<ll,ll> pll;
typedef vector<pll> vpll;
typedef vector<string> vs;

int main() 
{
	char a[52] = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
	
	int n;
	while(cin >> n && n!=0)
	{
		int b[52]={};
		REP(i,n){cin >> b[i];} //カギ
		
		char c[100]={}; //文字
		cin >> c;
		
		
		REP(i,sizeof(c))
		{
			REP(j,52)
			{
				if(c[i]==a[j])
				{
					cout << a[( j - b[i % n] ) % 52];
					break;
				}
			}
		}
		cout << endl;
	}
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;


int main(){
  char stat[55];
  strcpy(stat,"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");

while(1){
  int i,N,K,ansst[105],cst,cnt=0,key[105];
  cin>>N;
  if(N==0)return 0;
  for(i=0;i<N;i++){
    scanf("%d",&key[i]);
  }
  char ss[105];
  scanf("%s",ss);
  K=strlen(ss);
  for(i=0;i<K;i++){
    if(ss[i]>='a'&&ss[i]<='z'){
      cst=ss[i]-'a';
    }else{
      cst=ss[i]-'A'+26;
    }
    ansst[i]=(cst-key[cnt]+52)%52;
    cnt=(cnt+1)%N;
  }
  for(i=0;i<K;i++){
    printf("%c",stat[ansst[i]]);
  }
  printf("\n");
}
}

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

using namespace std;

#define loop(i,a,b) for(int i=(a); i<(int)(b); i++)
#define rep(i,b) loop(i,0,b)

map<int,char> itoc, ctoi;
int main(){
    int n;
    rep(i,26){
        itoc[i]='A'+i;
        itoc[i+26]='a'+i;
        ctoi['A'+i]=i;
        ctoi['a'+i]=i+26;
    }

    while(cin>>n){
        vector<int> key(n);
        rep(i,n) cin>>key[i];
        string m; cin>>m;
        rep(i,m.size()){
            int c=ctoi[m[i]];
            c=(c-key[i%(key.size())]+52)%52;
            cout<<itoc[c];
        }
        cout<<endl;
    }
}

C++: #include <bits/stdc++.h>
using namespace std;

vector<int> keys;

int main(){
while(1){//start

	//init
	keys.clear();

	int n;
	cin >> n;
	if(n == 0) break;
	for(int i = 0; i < n; i++){
		int temp;
		cin >> temp;
		keys.push_back(temp);
	}

	//extend keys
	for(int i = 0; i < 200; i++){
		int temp = keys[i];
		keys.push_back(temp);
	}

	string s;
	cin >> s;
	for(int i = 0; i < (int)s.size(); i++){
			char c;
			if(islower(s[i])){
				int dist = s[i] - 'a';
				if(dist - keys[i] < 0){
					keys[i] -= dist;
					if(keys[i] >= 26){
						keys[i] -= 26;
						c = 'z' - keys[i] + 1;
						cout << c;
					}
					else{
						c = 'Z' - keys[i] + 1;
						cout << c;
					}
				}
				else{
					c = s[i] - keys[i];
					cout << c;
				}
			}

			else if(isupper(s[i])){
				int dist = s[i] - 'A';
				if(dist - keys[i] < 0){
					keys[i] -= dist;
					if(keys[i] >= 26){
						keys[i] -= 26;
						c = 'Z' - keys[i] + 1;
						//cout << "test3" << endl;
						cout << c;
					}
					else{
						c = 'z' - keys[i] + 1;
						//cout << "test2" << endl;
						cout << c;
					}
				}
				else{
					c = s[i] - keys[i];
					//cout << "test1" << endl;
					cout << c;
				}
			}
	}
	cout << endl;

}//end

	return 0;
}

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

using namespace std;

const string ord = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";

int main(void) {
  int n;
  while (cin >> n, n) {
    vector<int> k(n);
    for (int i = 0; i < n; i++) {
      cin >> k[i];
    }

    string s;
    cin >> s;

    int l = 0;
    string ans = "";
    for (int i = 0; i < s.size(); i++) {
      ans += ord[(ord.find(s[i]) - k[l] + ord.size()) % ord.size()];
      l = (l + 1) % k.size();
    }

    cout << ans << endl;
  }
  

  return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;
int main() {
	int n;
	while (cin >> n) {
		if (!n)return 0;
		int a[114514]; 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 <bits/stdc++.h>
using namespace std;
string eki = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";

int main(){
	int N;
	while(1){
        cin>>N; 
        if(N==0) break;
		vector<int> k(N);
		for(int i=0; i<N; i++)cin >> k[i];
		
		string S;
		cin >> S;
		
		string ans;
		int pos=0;
		for( int i=0; i<S.size(); i++){
			int num;
			if('a'<= S[i] && S[i] <= 'z'){
				num = S[i] - 'a';
			}
			else if('A' <= S[i] && S[i] <= 'Z'){
				num = S[i] - 39;
			}
			char res = eki[ ( num - k[pos] + 52 ) % 52 ];
			pos = (pos+1)%N;
			ans += res;
		}
		cout << ans << endl;
	}
	return 0;
}