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 <bits/stdc++.h>
using namespace std;

using ll = long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;

#define REP(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define FORR(i,a,b) for(int i=(b)-1; i>=(a); i--)

#define ALL(v) (v).begin(), (v).end()
#define CHMAX(a,b) a=max(a,b)
#define CHMIN(a,b) a=min(a,b)

#define DEBUG(x) cerr<<#x<<": "<<(x)<<endl

int n;
int key[125];
char s[125];

int main(){
    while(true){
        scanf("%d",&n);
        if(n==0)break;
        REP(i,n)scanf("%d",key+i);
        fill(s,s+125,'\0');
        scanf("%s",s);
        int len = strlen(s);
        REP(i,len){
            int k = key[i%n];
            int id = 0;
            if(isupper(s[i])){
                id = s[i] - 'A';
            }else{
                id = s[i] - 'a' + 26;
            }
            id = (id + 52 - k) % 52;
            if(id < 26){
                putchar('A'+id);
            }else{
                putchar('a'+(id-26));
            }
        }
        puts("");
    }
    return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
using namespace std;

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

		string list;
		cin.ignore();
		getline(cin, list);

		int bi = 0;
		for (int i = 0; i < list.size(); i++) {
			int n = back[bi];
			while (n > 0) {
				if (list[i] == 'a')
					list[i] = 'Z';
				else if (list[i] == 'A')
					list[i] = 'z';
				else
					list[i] = list[i] - 1;

				n--;
			}

			bi = (bi + 1) % N;
		}
		cout << list << endl;
	}
}

C++: #include<cstdio>
#include<algorithm>

using namespace std;

int main(void) {
    char list[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";

    while(true) {
        int n,k[200];
        char s[150]={};

        scanf("%d", &n);
        if(!n) break;

        for(int i=0; i<n; i++)
            scanf("%d", &k[i]);

        scanf("%s",s);

        for(int i=0; s[i]; i++) {
            printf("%c", list[((lower_bound(list, list+52, s[i])-list)-k[i%n]+52)%52]);
        }
        printf("\n");
    }
    return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <iostream>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <set>
#define repl(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) (x).begin(), (x).end()
#define FILL(v, value) (v+(sizeof(v) / sizeof *(v)), value);
#define inf 999999999
#define dbg(x) cout<<#x<<":"<<x<<endl;
#define pb(a) push_back((a))
#define mp(a) make_pair((a))
#define sz(x) (int)(x).size()
#define pi 2*acos(0.0)
#define in scanf
#define out printf
#define fi first
#define se second
#define bit(n) (1LL<<(n))
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;

const int MOD=1000000007; // 10^9 + 7
const int dx[]={1,0,-1,0}, dy[]={0,-1,0,1};  // right, down, left, up

string moji = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
int main(int argc, char**argv){
	int n;
	while(1){
		cin >> n;
		if (n == 0) break;
		vi k;
		rep(i, n){
			int tmp;
			cin >> tmp;
			k.pb(tmp);
		}
		string s;
		cin >> s;

		rep(i, sz(s)){
			int ix = moji.find(s[i]);
			s[i] = moji[ix - k[i % sz(k)]];
		}
		cout << s << endl;

	}

	return 0;
}

C++: #include <iostream>
#include <string>
using namespace std;

bool notrange(char a){
  return (!(('a' <= a && a <= 'z') || ('A' <= a && a <= 'Z')));
}

int main(){
  
  while(1){
  	int n;
  	cin >> n;
  	if(n == 0) break;
  	int i;
  	int k[100];
  	for (i = 0; i < n; i++) {
  	  cin >> k[i];
  	}
  	string str = "";
  	cin >> str;
  	int j;
  	string str2 = "";
  	int a = 0;
	
  	for(j = 0;j < (int) str.length();j++){
  	  a = j;
  	  while(!(a < i)){
  		a -= i;
  	  }

  	  char c = str[j] - k[a];
	  
  	  if(c < 'a' && c > 'Z' && notrange(c)){
		// cout << 'a' -c << endl;
  		c = 'Z'-('a' - c - 1);
  	  }
  	  if(c < 'A' && notrange(c)){
  		c = 'z' - ('A' - c - 1);
  	  }
	  if(c < 'a' && c > 'Z' && notrange(c)){
  		c = 'Z'-('a' - c - 1);
  	  }
	  if(c < 'A' && notrange(c)){
  		c = 'z' - ('A' - c - 1);
  	  }

  	  cout << c;
  	}
  	cout << endl;
  }

  return 0;
}