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>
#include<algorithm>

char sta[] = { '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' };

void calc(char &c,int key){

	int it = std::find(sta, sta + 52, c) - sta;

	if (it - key < 0)it += 52;
	it -= key;

	c = sta[it];
}

int main(){
	int n;
	while (std::cin >> n, n){

		std::vector<int>k(n);
		for (int i = 0; i < n; i++)std::cin >> k[i];

		std::string str;
		std::cin >> str;


		for (int i = 0, key = 0; i < str.size(); i++, key++){
			if (key == n)key -= n;

			calc(str[i], k[key]);

		}

		std::cout << str << std::endl;
	}
	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<functional>
#include<queue>
#include<algorithm>
#include<complex>
#include<cstdlib>
#include<cctype>

#define REP(i,n) for(int i = 0;i < (n);i++)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int i = 0;i < (n);i++)cout << v[i] << ' ';cout << endl << endl;}
#define SHOW2d(v,i,j) {for(int a = 0;a < i;a++){for(int b = 0;b < j;b++)cout << v[a][b] << ' ';cout << endl;}cout << endl;}
#define ALL(v) v.begin(),v.end()

using namespace std;

typedef long long ll;
typedef vector<int> iv;
typedef vector<iv> iiv;
typedef vector<string> sv;

char f(char c,int n)
{
//	cout << c << ' ';
	REP(i,n)
	{
		if(c == 'a')
			c = 'Z';
		else if(c == 'A')
			c = 'z';
		else
			c--;
	}
//	cout << c << endl;
	return c;
}

int main()
{
	int n;
	
	while(cin >> n,n)
	{
		iv v;
		REP(i,n)
		{
			int tmp;
			cin >> tmp;
			v.PB(tmp);
		}
		
		string str;
		cin >> str;
		
		REP(i,str.size())
		{
			str[i] = f(str[i],v[i%n]);
		}
		
		cout << str << endl;
	}
	
	return 0;
}

C++: #include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <ostream>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define INF 1000000000
#define rep(i,a,b) for (int i=(a);i<(b);i++)
#define rev(i,a,b) for (int i=(a)-1;i>=b;i--)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef queue<int> qi;
typedef vector<int> vi;
typedef vector<string> vs;
int dx[4] = { 0, 1, 0, -1 };
int dy[4] = { 1, 0, -1, 0 };

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

  while(true) {
		int n;
		cin >> n;
		if(n == 0) break;

		vi k(n);
		rep(i,0,n) cin >> k[i];
		string s;
		cin >> s;

		string ans = "";
		string a = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
		rep(i,0,s.size()) {
			int num = a.find(s[i]) - k[i%n]%a.size();
			if(num < 0) num += a.size();
			ans += a[num];
		}
		cout << ans << endl;
  }

	return 0;
}

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

using namespace std;

int main() {
	int n;

	while(true) {
		cin >> n;

		if(!n) {
			break;
		}

		vector< int > k(n);
		string str;

		for(int i = 0; i < k.size(); i++) {
			cin >> k[i];
		}
		cin >> str;

		int tmp = 0, count = 0;
		string ans;

		for(int i = 0; i < str.size(); i++) {
			str[i] -= k[count];
			count++;
			if(count == k.size()) {
				count = 0;
			}
		}


		for(int i = 0; i < str.size(); i++) {
			if(str[i] < 'A') {
				tmp = 'A' - str[i];
				if(tmp < 26) {
					str[i] = ('z' + 1) - tmp;
				} else if(26 <= tmp && tmp < 52) {
					tmp -= 26;
					str[i] = ('Z' + 1) - tmp;
				} else if(tmp >= 52) {
					tmp = tmp % 52;
					str[i] = str[i] - tmp;
					if(str[i] < 'A') {
						tmp = 'A' - str[i];
						str[i] = ('z' + 1) - tmp;
					}
				}
			} else if('Z' < str[i] && str[i] < 'a') {
				tmp = ('a' - str[i]);
				cout << tmp << endl;
				if(tmp < 26) {
					str[i] = ('Z' + 1) - tmp;
				} else if(26 <= tmp && tmp < 52) {
					tmp -= 26;
					str[i] = ('z' + 1) - tmp;
				} else if(tmp >= 52) {
					tmp = tmp % 52;
					str[i] = str[i] - tmp;
					if(str[i] < 'Z') {
						tmp = 'Z' - str[i] + 'z';
						str[i] = ('Z' + 1) - tmp;
					}
				}
			}
		}

		cout << str << endl;
	}
}