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<strstream>
#include<stack>
#include<utility>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<cmath>
#include<climits>
#include<map>
#include<string>
#include<sstream>

using namespace std;

#define mp make_pair
#define rep(i,n) for( int i = 0; i < n; i++ )
typedef long long int ll;

int main()
{
	int n;
	while( cin >> n, n )
	{
		vector<int> v(n);
		rep(i,n)
		{
			cin >> v[i];
		}
		string s;
		cin >> s;

		int v_i = 0;
		for( int i = 0; i < s.size(); i++)
		{
			if( v_i > n-1 ){
				v_i = 0;
			}
			rep(j,v[v_i])
			{
				s[i]--;
				if( s[i] == 64 ){
					s[i] = 'z';
				}
				if( s[i] == 96 ){
					s[i] = 'Z';
				}
			}
			v_i++;
		}
		cout << s << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>

using namespace std;

// typedef
typedef long long ll;

// container util
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c) (c).rbegin(), (c).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(c) int((c).size())
#define EACH(i,c) for(auto (i)=(c).begin(); (i)!=(c).end(); ++(i))
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(ALL(c))

// repetition
#define FOR(i,m,n) for(ll (i) = ((ll) m); (i) < ((ll) n); ++(i))
#define RFOR(i,m,n) for(ll (i) = ((ll) (m)-1); (i) >= ((ll) n); --(i))
#define REP(i,n) FOR(i,0,n)

// i/o
#define TFOUT(b,t,f) cout << ((b)? (t) : (f)) << endl;

// constant
const double    EPS     = 1e-10;
const int       INFTY   = (1<<21);
const ll        MOD     = (ll) 1e9+7;

// clear memory
#define CLR(a) memset((a),0,sizeof(a))

// debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ") " << " " << __FILE__ << endl;

string solve(int n) {
    vector<int> keys;
    string code;
    REP(i, n) {
        int e; cin >> e;
        keys.PB(e);
    }
    cin >> code;
    REP(i, code.length()) {
        int key = keys[i % n];
        int index = 0;
        if ('a'<= code[i] && code[i] <= 'z') {
            index = code[i] - 'a';
        } else if('A'<= code[i] && code[i] <= 'Z') {
            index = code[i] - 'A' + 26;
        }
        int new_index = (index - key + 52) % 52;
        if(new_index < 26) {
            code[i] = 'a' + new_index;
        } else {
            code[i] = 'A' + new_index - 26;
        }
    }
    return code;
}
int main() {
    while(true) {
        int n; cin >> n;
        if(n == 0) break;
        cout << solve(n) << endl;
    }
    return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <ctime>
#define INF 999999999
#define mod 1000000007

#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=(n);i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define MOD(x) (x%(mod))
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool debug=false;
/*---------------------------------------------------*/

int n,k[105];
string s;

void solve(){
  rep(i,s.size()){
    rep(j,k[i%n]){
      if(s[i]=='A')s[i]='z';
      else if(s[i]=='a')s[i]='Z';
      else s[i]=char(int(s[i])-1);
    }
  }
  cout<<s<<endl;
}

int main(){
  while(cin>>n){
    if(n==0)break;
    rep(i,n)cin>>k[i];
    cin>>s;
    solve();
  }
  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int key[101];

int main(){
  int n;
  while(cin>>n,n){
    for(int i=0;i<n;i++) cin>> key[i];
    string str;
  cin>>str;
  int idx=0;
  for(int i=0;i<str.size();i++){
    idx%=n;
    str[i]-=key[idx++];
    if(str[i]<'A') str[i]='z'-('A'-str[i]-1);
    else if('Z'<str[i]&&str[i]<'a') str[i]='Z'-('a'-str[i]-1);
  }
  cout <<str<<endl;
  }
  return 0;
}

C++: #include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
#include <functional>
using namespace std;

int main()
{
    for(;;){
        int n;
        cin >> n;
        if(n == 0)
            return 0;

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

        string s;
        cin >> s;
        for(unsigned i=0; i<s.size(); ++i){
            int a;
            if('a' <= s[i] && s[i] <= 'z')
                a = s[i] - 'a';
            else
                a = s[i] - 'A' + 26;

            a += 52 - k[i%n];
            a %= 52;

            if(a < 26)
                cout << (char)('a' + a);
            else
                cout << (char)('A' + a - 26);
        }
        cout << endl;
    }
}

C++: #include <iostream>
#include <cstdio>
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;

int main()
{
  
  while(1){
    int n;
    cin >> n;
    if(n == 0) break;
    int k[n];
    REP(i,n)
      cin >> k[i];
    string s;
    cin >> s;
    int x = 0;
    REP(i,(int)s.size()){
      if(s[i] >= 97)
        if(s[i] - k[x] < 97)
          s[i] = 90 - (k[x] - (s[i] - 97)) + 1;
        else
          s[i] -= k[x];
      else
        if(s[i] - k[x] < 65)
          s[i] = 122 - (k[x] - (s[i] - 65)) + 1;
        else
          s[i] -= k[x];
      x++;
      x %= n;
    }
    cout << s << endl;
  }
}