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>
using namespace std;

int n;
int t[102];
string s, alpha;
int idx[128];

int main(){
  alpha = "";

  for(int i = 0; i < 26; i++){
    char ch = 'A' + i;
    alpha += ch;
    idx[ch] = i;
  }
  for(int i = 0; i < 26; i++){
    char ch = 'a' + i;
    alpha += ch;
    idx[ch] = i + 26;
  }

  while(cin >> n, n){
    for(int i = 0; i < n; i++){
      cin >> t[i];
    }

    cin >> s;

    for(int i = 0; i < s.size(); i++){
      int md = i % n;
      s[i] = alpha[(idx[s[i]] + 52 - t[md]) % 52];
    }

    cout << s << endl;
  }
}

C++: #include <bits/stdc++.h>
using namespace std;
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;
}
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MOD (1000000007)
#define ALL(v) (v).begin(), (v).end()
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

//-------------------------------------

string alp = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";

char transform(char c, int back)
{
    int index = 0;
    for (int i = 0; i < (int)alp.size(); i++)
    {
        if (c == alp[i])
        {
            index = i;
        }
    }
    int ans_index = index - back;
    if (ans_index < 0)
    {
        ans_index += (int)alp.size();
    }
    return alp[ans_index];
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    while (true)
    {
        int n;
        cin >> n;
        if(n == 0){
            return 0;
        }
        vector<int> key(n);
        string s;
        for (int i = 0; i < n; i++)
        {
            cin >> key[i];
        }
        cin >> s;

        for (int i = 0; i < (int)s.size(); i++)
        {
            int back = key[i % n]; // 戻すべき文字数
            s[i] = transform(s[i], back);
        }
        cout << s << endl;
    }
}

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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) begin(r),end(r)
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init))
#define mp(a,b) make_pair(a,b)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;
  string u = "";
  map<char,int> m;
  map<int,char> d;
  rep(i,26){
    m['a' + i] = i;
  }
  rep(i,26){
    m['A' + i] = i + 26;
  }
  rep(i,26){
    d[i] = i +'a';
  }
  rep(i,26){
    d[26+ i] = i + 'A';
  }
  while(cin >> n,n){
    vector<ll> k(n);
    rep(i,n){
      cin >> k[i];
    } 
    string s;cin >> s;
    rep(i,s.size()){
      /* cout << (m[s[i]] - k[i % n])%52 << endl; */
      cout << d[(m[s[i]] - k[i % n]+52)%52];
    }
    cout << endl;
  }
  return 0;
}

C++: #include <iostream>
#include <string>
using namespace std;
int main(){
	int n;
	string r[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(cin>>n){
		if(n==0) break;
		int a[n];
		for(int i=0;i<n;i++){
			cin>>a[i];
		}
		string s;
		cin>>s;
		int len=s.size();
		for(int i=0;i<len;i++){
			string si=s.substr(i,1);
			for(int j=0;j<52;j++){
				if(r[j]==si){
					cout<<r[(j-a[i%n]+52)%52];
					break;
				}
			}
		}
		cout<<endl;
	}
    return 0;
}

C++: /*
 * 2508.cc: King's Inspection
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 100;

/* typedef */

/* global variables */

int ks[MAX_N];

/* subroutines */

/* main */

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

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

    string s;
    cin >> s;
    int m = s.size();

    for (int i = 0, j = 0; i < m; i++, j = (j + 1) % n) {
      int d = (s[i] >= 'a' && s[i] <= 'z') ? s[i] - 'a' : s[i] - 'A' + 26;
      d = (d + 52 - ks[j]) % 52;
      putchar((d < 26) ? 'a' + d : 'A' + d - 26);
    }
    putchar('\n');
  }

  return 0;
}

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

#define REP(i, n) for(int i = 0; i < (int) (n); i++)
#define ALL(v) (v).begin(), (v).end()
#define INF 1e9

using namespace std;

char alphabet[52];

int main(){
  int n;
  REP(i, 26){ alphabet[i] = char('A' + i); }
  REP(i, 26){ alphabet[i+26] = char('a' + i); }
  while(cin >> n and n){
    int keys[100];
    REP(i, n) cin >> keys[i];
    for(int i = n; i < 100; i++) keys[i] = keys[i-n];
    string list;
    cin >> list;
    REP(i, list.size()){
      int target;
      if(list[i] < 'a') target = list[i]-'A';
      else target = list[i]-'a'+26;
      cout << alphabet[(target - keys[i] + 52) % 52];
    }
    cout << endl;
  }
  return 0;
}