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 <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef pair<int,int> pint;
typedef pair<long long, long long> pll;

#define MP make_pair
#define PB push_back
#define ALL(s) (s).begin(),(s).end()
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P) 
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P) 
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P) 
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }



int n;
int back[1000];

map<char,char> prev;

int main() {
    prev.clear();
    for (int i = 0; i < 25; ++i) {
        prev['a'+(i+1)] = 'a'+i;
        prev['A'+(i+1)] = 'A'+i;
    }
    prev['a'] = 'Z';
    prev['A'] = 'z';
    
    while (cin >> n) {
        if (n == 0) break;
        
        for (int i = 0; i < n; ++i) cin >> back[i];
        string str;
        cin >> str;
        
        for (int i = 0; i < str.size(); ++i) {
            for (int j = 0; j < back[ i%n ]; ++j) {
                str[i] = prev[str[i]];
            }
        }
    
        cout << str << endl;
    }
    
    return 0;
}

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

int main()
{
	int N;
	string chipher;

	while(cin >> N)
	{
		if (N == 0) { break; }
		vector<int> keys(N);

		for(int i = 0; i < N; i++) {
			cin >> keys[i];
		}
		cin >> chipher;
		
		for(int i = 0; i < chipher.size(); i++)
		{
			char ans;
			int ii = i % keys.size();
			int diff_i;
			bool upper = true;
			if ('a' <= chipher[i] && chipher[i] <= 'z')
			{
				diff_i = chipher[i] - 'a';
				upper = false;
			}
			else if ('A' <= chipher[i] && chipher[i] <= 'Z')
			{
				diff_i = chipher[i] - 'A';
				upper = true;
			}
			int left_diff_i = diff_i - keys[ii];
			//cout << left_diff_i << " ";
			
			//int left_diff_i = diff_i - keys[ii];
			while(left_diff_i < 0) {
				left_diff_i = 26 + left_diff_i;
				upper = !upper;
			}

			if (upper) {
				cout << (char)('A'+left_diff_i);
			}
			else {
				cout << (char)('a'+left_diff_i);
			}

		}
		cout << endl;
	}
	return EXIT_SUCCESS;
}

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

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define erep(i, m, n) for(int (i)=(m); (i)<=(n); (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define rrev(i, m, n) for(int (i)=(n)-1; (i)>=(m); (i)--)
#define erev(i, m, n) for(int (i)=(n); (i)>=(m); (i)--)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define pb            push_back
template<class T, class S> inline pair<T, S> mp(T x, S y){ return make_pair(x, y); }
template<class T, class S> inline bool minup(T& m, S x){ return m>(T)x ? (m=(T)x, true) : false; }
template<class T, class S> inline bool maxup(T& m, S x){ return m<(T)x ? (m=(T)x, true) : false; }

static const int    INF = 1000000000;
static const ll     MOD = 1000000007LL;
static const double EPS = 1E-12;

int n;
string s;

inline bool isLower(char c){ return 'a' <= c && c <= 'z'; }
inline bool isUpper(char c){ return 'A' <= c && c <= 'Z'; }

int main()
{
  while(cin >> n, n){
    vi k(n);
    rep(i, n) cin >> k[i];
    cin >> s;
    int p = 0;
    vrep(v, s){
      if(isLower(*v)){
        if(isLower(*v - k[p])){
          cout << (char)(*v - k[p]);
        }
        else{
          cout << (char)('Z' - 'a' + *v - k[p] + 1);
        }
      }
      else{
        if(isUpper(*v - k[p])){
          cout << (char)(*v - k[p]);
        }
        else{
          cout << (char)('z' - 'A' + *v - k[p] + 1);
        }
      }
      p = (p + 1) % k.size();
    }
    cout << endl;
  }

  return 0;
}

C++: #include<iostream>
#include<string>
#include<vector>
using namespace std;
int main(){
  int n;
  while(cin >> n,n){
    int k[n];
    for(int i=0;i<n;i++) cin >> k[i];
    string s;
    cin >> s;
    int j=0;
    for(int i=0;i<s.size();i++){
      if(j==n)j=0;
      s[i]-=k[j];
      if(s[i]<65)s[i]+=58;
      if(s[i]>90&&s[i]<97)s[i]-=6;
      j++;
    }
  cout << s << endl;
  }
}