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>
//#include<iostream>
using namespace std;
//type
typedef long long ll;
#define pii pair<int, int>
#define vi vector<int>
//x * y * 1.0 can cause overflow
//constant
#define inf (int)(1e9+7)
#define mod (ll)(1e9+7)
#define eps 1e-10
//omission
#define eb emplace_back
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define all(v) v.begin(), v.end()
#define ios cin.tie(0); ios::sync_with_stdio(false)
#define FIX(a) cout << fixed << setprecision(a)
#define mp make_pair
//manip
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 (b<a) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(unique(v.begin(), v.end(), v.end());
#define fill(x, y) memset(x, y, sizeof(x))
#define ceil(a, b) a / b + !!(a % b)
template<class T> T power_mod(T a, T b) {return b ? power(a * a % inf, b / 2) * (b % 2 ? a : 1) % inf : 1;}
template<class T> T power(T a, T b) {return b ? power(a * a, b / 2) * (b % 2 ? a : 1) : 1;}
#define LB(v, x) (int)(lower_bound(v.begin(), v.end(), x) - v.begin())
#define UB(v, x) (int)(upper_bound(v.begin(), v.end(), x) - v.begin())
template<typename T> T gcd(T a, T b) {if (b == 0) return a; return gcd(b, a % b);}
template<typename T> T lcm(T a, T b) {return a / gcd(max(a, b), min(a, b)) * b;} //先に割る!!
#define outa(a, n) rep(i_, n) cout << a[i_] << " "; cout << endl
#define out(a) cout << a << endl
#define outv(v) rep(i, SZ(v)) cout << v[i] << " "; cout << endl
//loop
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep3(i, st, n) for (int i = st; i < n; ++i)
//algorithm
//double pointer, l start, how many adds, can be 0 -> init r = l, sum = 0
//bfs, not x, y, i, j
//not !(i % 2), i % 2 == 0
//minimal required terms
//cast caution
//look constraints always



int main() {
    
    
    
    
    int n;
    string t = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
    while (cin >> n && n) {
        int k[n]; rep(i, n) cin >> k[i];
        string s; cin >> s;
        
        rep(i, SZ(s)) {
            for (int j = 26 * 4 - 1; j >= 0; --j) {
                if (t[j] == s[i]) {
                    cout << (char)(t[j - k[i % n]]);
                    break;
                }
            }
            
        }
        cout << endl;
    }
    
    
    
    
}

C++: #include<iostream>
#include<list>
#include<vector>
#include<algorithm>
#include<string>
#include<stdio.h>
#include<math.h>
#include<unordered_map>

using namespace std;
using vec = vector<int>;
using mat = vector<vec>;
using lst = list<int>;


vector<char> stationList(52);
unordered_map<char, int> AtoI;


bool solve()
{
	int N;
	cin >> N;

	if (N == 0)return false;

	vec K(N);

	for (int i = 0; i < N; ++i)
	{
		cin >> K[i];
	}

	string s;
	cin >> s;

	for (int i = 0; i < s.length(); ++i)
	{
		int id = AtoI[s[i]];
		id = (id - K[i % N] + 52) % 52;
		cout << stationList[id];
	}

	cout << endl;

	return true;
}


int main()
{
	for (int i = 0; i < 26; ++i)
	{
		stationList[i] = (char)(i + 'a');
		AtoI[(char)(i + 'a')] = i;
	}
	for (int i = 0; i < 26; ++i)
	{
		stationList[i + 26] = (char)(i + 'A');
		AtoI[(char)(i + 'A')] = i + 26;
	}


	while(solve())
	{
	}

	return 0;
}

C++: #include <iostream>
#include <string>
using namespace std;
int main(){
  int i,j,n,k[100],l,len,h;
  string s,out;
  char data[52]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
  while(1){
    out="";
    cin >> n;
    if(n==0) break;
    for(i=0;i<n;i++){
      cin >> k[i];
    }
    cin >> s;
    len=s.size();
    for(i=0,l=0;i<len;i++,l++){
      if(l==n) l=0;
      for(j=0;j<52;j++){
	if(s[i]==data[j]){
	  if(j-k[l]<0){
	    h=k[l]-j;
	    out+=data[52-h];
	  }
	  else out+=data[j-k[l]];
	}
      }
    }
    cout << out << endl;
  }
  return 0;
}

C++: #include <bits/stdc++.h>

inline char shift(char c, int x) {
    int d;
    char nc;
    if(c >= 'a' && c <= 'z') {
        nc = (char)(c - x);
        if(nc >= 'a' && nc <= 'z') {
            return nc;
        }
        d = 'a' - nc;
        return (char)('Z' - d + 1);
    } else {
        nc = (char)(c - x);
        if(nc >= 'A' && nc <= 'Z') {
            return nc;
        }
        d = 'A' - nc;
        return (char)('z' - d + 1);
    }
} 

int main() {
    int n;
    std::vector<int> k(100);
    std::string s;

    int i, l;
    while(std::cin >> n, n != 0) {
        for(i = 0; i < n; ++i) {
            std::cin >> k[i];
        }
        std::cin >> s;

        l = s.length();
        for(i = 0; i < l; ++i) {
            std::cout << shift(s[i], k[i % n]);
        }
        std::cout << std::endl;
    }
}

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

using namespace std;

#define rep(i,n) for(int i = 0;i < n;i++)
#define For(i,a,b) for(int i = a;i < b;i++)
#define all(n) n.begin(),n.end()

int main() {
	int n;
	map<char, int> mp;
	string tb;
	for (char c = 'a'; c <= 'z'; c++) {
		mp[c] = tb.size();
		tb += c;
	}
	for (char c = 'A'; c <= 'Z'; c++) {
		mp[c] = tb.size();
		tb += c;
	}
	while (cin >> n && n) {
		vector<int> a(n);
		rep(i, n) {
			cin >> a[i];
		}
		string s;
		cin >> s;
		rep(i, s.size()) {
			int move = a[i % n];
			int now = mp[s[i]];
			cout << tb[(now - move + tb.size()) % tb.size()];
		}
		cout << endl;
	}

	return 0;
}