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++: /*
Hokudai Practice Contest 2014
A - King's Inspection

テδ「テッツ」ツソテδア@テδ?テδ鰻テδ円テδ嘉δ姪δ嘉δ・テδ?テδ鰻テδ嘉δ。テδ嘉δャ
テδィテδォテδ?つゥテδ?δ催δ??津δ?つ「テδ?δ暗δ嘉δ」テδ?テδ嘉δ」テδ?「ツ?ヲテδィ]テδ?つ。テδ??津δッテδコテδ・テ「ツ可・テδ?「ツ按妥δ?δ暗δ?δヲテδ?δ佚δ?
テδ嘉δ」テδ?テδ嘉δ」テδ?ッツ」ツソテδァテ?津δ・テつェテδ?「ツ按妥δ?δ暗δ?篠ゥテδ?ッツャツづδ?「ツ?ヲテδ?δ陛δ嘉δ、テδ厩テδ曳テδ?δεδィzテδ、テつャテδ?「ツ?堙δッテ「ツ按づδゥテδカテδ?δεδィzテδ、テつャテδ?ッツ」ツソテδァテ?津δ・テつェテδ?「ツ按妥δ?δ暗δッKテδウvテδ?「ツ?「テδ?「ツ??δ?δ暗δ?
(M-1)+1 -> 0, 0-1 -> (M-1)テδ?テδ?「ツ按?δ?つサテδ?δ暗δ?δ甘δ?つァテδ?「ツ?ヲテδ?「ツ按妥δ?δ暗δ?「ツ?ヲテδ?δ陛δ?テδィテδ凝δウ](%)テδ?ッツ」ツソテδウpテδ?つ「テδ?δ催δ??津δ?δ甘δ?つ「テδ?

テδゥテδサテδ、テ「ツ?佚δ・vテδゥZテδウテつ?δ?O(|s|)
テδ」テδ崚δ、テ「ツ?佚δ・vテδゥZテδウテつ?δ?O(n + |s|)
*/

#include<iostream>
#include<cctype>
using namespace std;

//a-zA-z -> テδィテδ。テδョテ「ツ??
int toInt(char a){
  if(islower(a))return a-'a';
  return a-'A'+26;
}

//テδィテδ。テδョテ「ツ??-> a-zA-Z
char toChar(int a){
  if(a<26)return 'a'+a;
  return 'A'+a-26;
}

//テδ「wテδェテδョ
const int M = 52;

int main(){
  int n,k[100];
  string s;

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

    for(int i=0;i<(int)s.size();i++){
      //テδィzテδ、テつャテδ?ッツ」ツソテδ鰻テδ円テδ嘉δ姪δ嘉δ・テδ?テδ鰻テδ嘉δ。テδ嘉δャテδ?「ツ按妥δ?δ暗δ?「ツ?ヲテδ?δ瀕odテδ?ッツ」ツソテδゥgテδ?つカテδ??津δウテつォテδ?つ「
      int tmp = toInt(s[i]) - k[i%n];
      //テδッテδ「テδェテδョテδ?「ツ?。テδ?「ツ??δ?δ凝δャテδヲテδ?δ暗δィテδ催δァテδ。テδ?δεδ?つソテδォSテδ?つサmodテδ?δεδゥテδ甘δ?δ凝δッテ仰堙δ?δ?(x%mod) + mod)%mod
      tmp = ((tmp%M) + M) % M;
      cout << toChar(tmp);
    }
    cout << endl;
  }
}

C++: #include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#include<string>
#include<cctype>
#include<cmath>

using namespace std;

string str="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";

char encode(char a,int k){
	int b;
	if(isupper(a))b=a-'A';
	else b=a-'a'+26;
	if(b-k>=0)return str[b-k];
	return str[52-abs(b-k)];
}

int main(void){
	
	int n;
	while(cin >> n,n){
		vector<int>k(n);
		for(int i=0;i<n;i++){
			cin >> k[i];
		}
		string s;
		cin >> s;
		for(int i=0;i<s.size();i++)s[i]=encode(s[i],k[i%n]);
		cout << s << endl;
	}
	
	return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;
char T[53] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; int u[999], t[999], n, i, j;
int main() {
	string S, U;
	while (true) {
		U = "";
		cin >> n;
		if (n == 0) { break; }
		for (i = 0; i < n; i++) { cin >> t[i]; }
		cin >> S;
		for (i = 0; i < S.size(); i++) {
			for (j = 0; j < 52; j++) {
				if (S[i] == T[j]) {
					U += T[j - u[i%n]];
				}
			}
		}
		cout << U << endl;
	}
}

C++: #include<iostream>
#include<vector>
#include<string>
using namespace std;
int main(){
  int n;
  vector<int> ke;
  int da;
  string st;
  while(1){
    ke.erase(ke.begin(),ke.end());
    cin >> n;
    if(n==0)break;
    for(int i=0;i<n;i++){
      cin >> da;
      ke.push_back(da);
    }
    cin >> st;
    int j=0;
    for(int i=0;i<st.size();i++){
      if(st[i]>='A'&&st[i]<='Z'){
	if(st[i]-ke[j]<'A'){
	  st[i]='z'+1+st[i]-'A';
	}
      }
      if(st[i]>='a'&&st[i]<='z'){
	if(st[i]-ke[j]<'a'){
	  st[i]='Z'+1+st[i]-'a';
	}
      }
      st[i]-=ke[j];
      j++;
      if(j==n)j=0;
    }
    cout << st << endl;
  }
  return 0;
}

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

char unlock(char ld,int key){
	for(int i=0;i<key;i++){
		if(ld=='a')ld='Z';
		else if(ld=='A')ld='z';
		else --ld;
	}
	return ld;
}


int main(){
	while(true){
		int n;
		vector<int>key;
		vector<int>::iterator ki;
		string data;
		cin>>n;
		if(n==0)break;
		key.resize(n);
		ki=key.begin();
		for(int i=0;i<n;i++)cin>>key[i];
		cin>>data;
		for(string::iterator di=data.begin();di!=data.end();++di){
			*di=unlock(*di,*ki);
			ki++;
			if(ki==key.end())ki=key.begin();
		}
		cout<<data<<endl;
	}
	return 0;
}

C++: #include <iostream>
#include <vector>

using namespace std;

int main(){
	int n;
	while(cin >> n && n!=0){
		vector<int> v(n);
		for(int i=0;i<n;i++){
			cin >> v[i];
		}
		string s;
		cin >> s;
		int x;
		for(int i=0;i<s.size();i++){
			x = v[i%n];
			while(1){
				if(x==0)break;
				if(s[i]<='z'&&s[i]>='a'){
					if(s[i]-x<'a'){
						x-= (s[i]-'a')+1;
						s[i]='Z';
					}else{
						s[i] = s[i]-x;
						break;
					}
				}else{
					if(s[i]-x<'A'){
						x-= (s[i]-'A')+1;
						s[i]='z';
					}else{
						s[i] = s[i]-x;
						break;
					}
				}
			}
			cout << s[i];
		}
		cout << endl;
	}
	return 0;
}

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

using namespace std;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    while (cin >> n, n)
    {
        char a[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'};
        int k[n + 1];
        for (int i = 0; i < n; i++)
            cin >> k[i];
        string s;
        cin >> s;
        int len = s.length();
        for (int i = 0; i < len; i++)
        {
            int idx;
            if (s[i] >= 'a')
                idx = (s[i] - 'a');
            else
                idx = s[i] - 'A' + 26;
            idx = ((idx + 52 - k[i % n]) % 52);
            cout << a[idx];
        }
        cout << endl;
    }
}