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 <iostream>
#include <cstring>

using namespace std;

int num[108];

void decode(int l, int k[300], char s[108], char alph[56])
{	
	for(int i = 0; i < l; i++){
		if(s[i] >= 'a' && s[i] <= 'z'){
			num[i] = s[i] - 'a';
		}
		else{
			num[i] = s[i] - 'A' + 26;
		}
		if(num[i] - k[i] < 0){
			num[i] += 52 - k[i];
		}
		else{
			num[i] -= k[i];
		}
		cout << alph[num[i]];
	}
	puts("");
}


int main()
{
	int n, m, l;
	int k[300];
	char s[108];
	char alph[56];
	
	for(int i = 0; i < 26; i++){
		alph[i] = 'a' + i;
	}
	for(int i = 0; i < 26; i++){
		alph[i + 26] = 'A' + i;
	}

	
	while(scanf("%d", &n) != EOF){
		if(n == 0) break;
		for(int i = 0; i < n; i++){
			cin >> k[i];
		}
		cin >> s;
		
		m = n;
		l = strlen(s);
		while(l > m){
			for(int i = 1; i <= n; i++){
				k[m + i - 1] = k[i - 1];
			}
			m += n;
		}
		decode(l, k, s, alph);
	}
	return 0;
}

C++: #include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <climits>
#include <ctime>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <set>
#include <map>
#include <iostream>
#include <deque>
#include <complex>
#include <string>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <valarray>
#include <unordered_map>
#include <iterator>
#include <functional>
#include <cassert>
using namespace std;
typedef long long int ll;
typedef unsigned int uint;
typedef unsigned char uchar;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;

#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();i++)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin();i!=(c).rend();i++)
#define ALL(container) (container).begin(), (container).end()
#define RALL(container) (container).rbegin(), (container).rend()
#define SZ(container) ((int)container.size())
#define mp(a,b) make_pair(a, b)
#define pb push_back
#define eb emplace_back
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"["; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"]"; return os;
}
template<class T> ostream& operator<<(ostream &os, const set<T> &t) {
os<<"{"; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"}"; return os;
}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
template<class S, class T> pair<S,T> operator+(const pair<S,T> &s, const pair<S,T> &t){ return pair<S,T>(s.first+t.first, s.second+t.second);}
template<class S, class T> pair<S,T> operator-(const pair<S,T> &s, const pair<S,T> &t){ return pair<S,T>(s.first-t.first, s.second-t.second);}

const int INF = 1<<28;
const double EPS = 1e-8;
const int MOD = 1000000007;


int T, n, m;
string db("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
int main(int argc, char *argv[]){
	ios::sync_with_stdio(false);
	while(cin >> n, n){
		vi d(n);
		REP(i, n) cin >> d[i];
		string s;
		cin >> s;
		REP(i, s.size()){
			int j = find(ALL(db), s[i]) - db.begin();
			j = (j + 52 - d[i%n]) % 52;
			putchar(db[j]);
		}
		puts("");
	}
	return 0;
}

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

char convert(char s, int keyNumber) {
    char c;
    unordered_map<int, char> mItoC;
    unordered_map<char, int> mCtoI;
    for (int i = 'z'; i >= 'a'; i--) {
        mItoC[122 - i] = (char)i;
    }
    for (int i = 'Z'; i >= 'A'; i--) {
        mItoC[116 - i] = (char)i;
    }
    for (int i = 'z'; i >= 'a'; i--) {
        mCtoI[(char)i] = 122 - i;
    }
    for (int i = 'Z'; i >= 'A'; i--) {
        mCtoI[(char)i] = 116 - i;
    }
    c = mItoC[(mCtoI[s] + keyNumber) % 52];
    return c;
}

int main() {
    while (1) {
        int N;
        cin >> N;
        if (!N) break;
        vector<int> K(N);
        for (int i = 0; i < N; i++) {
            cin >> K[i];
        }
        string S;
        cin >> S;
        string ans = "";
        for (int i = 0; i < S.length(); i++) {
            ans += convert(S[i], K[i%N]);
        }
        cout << ans << endl;
    }
}

C++: #include <cstdio>
#include <iostream>
#include <cmath>
#include <ctype.h>
#include <cstring> 
#include <sstream>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>

using namespace std;

int main()
{
	int n;
	while(1){
		cin >> n;
		if(n == 0) break;
		int key[200];
		char s[200], right_s[200], ch;
		for(int i = 0; i < n; i++){
			cin >> key[i];
		}
		ch = getchar();
		fgets(s, sizeof(s), stdin);
		int wronglist[200]={0}, rightlist[200];
		for(int i = 0; i < strlen(s)-1; i++){
			wronglist[i] = s[i] - 'A';
			if(wronglist[i] > 25) wronglist[i] -= 6;
			rightlist[i] = wronglist[i] - key[i%n];
			if(rightlist[i] < 0) rightlist[i] = 52 + rightlist[i];
			if(rightlist[i] > 25) rightlist[i] += 6;
			right_s[i] = rightlist[i] + 'A';
		}
		right_s[strlen(s)-1] = '\0';
		cout << right_s << endl;
	}
	return 0;
}