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;

int main() {

  while( true ) {

    long long int n;
    cin >> n;
    if ( n == 0 ) break;

    vector< long long int > k;

    for ( long long int i = 0; i < n; i++ ) {
      long long int in;
      cin >> in;
      k.push_back( in );
    }

    string s;
    cin >> s;

    for ( long long int j = 0; j < s.size(); j++ ) {

      long long int b = k[ j % k.size() ];
      if ( b >= 26 ) {
	b -= 26;
	if ( s[j] >= 'a' && s[j] <= 'z' ) {
	  s[j] += 'A' - 'a';
	}else {
	  s[j] += 'a' - 'A';
	}
      }
      if ( s[j] >= 'a' && s[j] <= 'z' ) {
	s[j] -= b;
	if ( s[j] < 'a' ) {
	  s[j] += 26;
	  s[j] += 'A' - 'a';
	}
      }else {
	s[j] -= b;
	if ( s[j] < 'A' ) {
	  s[j] += 26;
	  s[j] += 'a' - 'A';
	}
      }

    }

    cout << s << endl;

  }

  return 0;

}

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

int main(){
	int n, j = 0;
	const string table = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
	string s, ans;
	while (1){
		cin >> n;
		if (!n)break;
		int k[101];
		for (int i = 0; i<n; ++i)cin >> k[i];
		cin >> s;
		for (int i = 0; i<s.size(); ++i){
			int a = table.find(s[i]) - k[j];
			if (a<0){
				ans += table[52 + a];
				j = (j + 1) % n;
			}
			else{
				ans += table[a];
				j = (j + 1) % n;
			}
		}
		cout << ans << endl;
		j = 0;
		ans.clear();
	}
}

C++: #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cctype>
#include <numeric>
using namespace std;

#define rep(i,n) for(int (i)=0; (i)<(int)(n); ++(i))
#define foreach(c,i) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)

int N;
int key[102];
string s;

void inc(int& idx) {
  ++idx;
  idx %= N;
}

char chg(char c, int didx) {
  if (islower(c)) {
    if ('a' <= (c - didx))
      return c - didx;
    return ('Z' + 1) - ('a' - (c - didx));
  }
  // isupper
  if ('A' <= (c - didx))
    return c - didx;
  return ('z' + 1) - ('A' - (c - didx));
}

string solve() {
  const int M = s.size();
  string ret = s;
  int idx = 0;
  rep(i,M) {
    ret[i] = chg(s[i], key[idx]);
    inc(idx);
  }
  return ret;
}

int main() {
  while (cin >> N, N) {
    rep(i,N) cin >> key[i];
    cin >> s;
    cout << solve() << endl;
  }
  return 0;
}

C++: #include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#include<complex>
#include<map>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define CC puts("-------ok--------");
#define all(in) in.begin(), in.end()
using namespace std;
typedef pair<int, int> pii;
#define MAX 99999999
int main(){
    int n;
    while(cin>>n,n){
        vi v(n);
        rep(i,n)cin>>v[i];
        string s; cin>>s;
        int cnt=0;
        rep(i,(int)s.length()){
            if(s[i]-v[cnt]>=91&&s[i]-v[cnt]<=96)
                printf("%c",s[i]-v[cnt++]-6);
            else if(s[i]-v[cnt]<65)
                printf("%c",s[i]-v[cnt++]+58);
            else
                printf("%c",s[i]-v[cnt++]);
            if(cnt==n)cnt=0;
        }
        cout<<endl;
    }
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstring>
#include <queue>
#include <stack>
#include <map>
#include <unordered_map>

using namespace std;

int main()
{
    int n, i;
    int key[52];
    string s;
    char ans[100];


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

        for(i = 0; i < n; i++){
            cin >> key[i];
        }
        cin >> s;

        for(i = 0; i < s.size(); i++){
            if(s[i] >= 'a' && s[i] <= 'z'){
                int num = key[i % n] - (s[i] - 'a');
                if(num > 0){
                    ans[i] = 'Z' - num;
                } else {
                    ans[i] = s[i] - key[i % n];
                }
            } else {
                int num = key[i % n] - (s[i] - 'A');
                if(num > 0){
                    ans[i] = 'z' - num;
                } else {
                    ans[i] = s[i] - key[i % n];
                }
            }
        }
        ans[s.size()] = '\0';

        cout << ans << endl;
    }

    return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<n;i++)
#define repb(i,a,b) for(int i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define int long long
#define fi first
#define se second
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

signed main(){
    int n;
    while(cin >> n, n){
        vi d(n);
        rep(i, 0, n){
            cin >> d[i];
        }
        string s;
        cin >> s;
        rep(i, 0, s.size()){
            s[i] = s[i] - d[i % n];
            if(!(('a' <= s[i] && s[i] <= 'z') || ('A' <= s[i] && s[i] <= 'Z'))){
                s[i] = s[i] + 26;
            }
        }
        cout << s << endl;
    }
}