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 <vector>
#include <string>

using namespace std;

int main() {
	int n;
	string abc = "abcdefghijklmnopqrstuvwxyz";
	string abcc = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	string aa = abcc + abc + abcc + abc;
	int sz = aa.size();
	while (cin >> n) {
		if (n == 0) {
			break;
		}
		vector<int> k(n);
		for (int i = 0; i < n; i++) {
			cin >> k[i];
		}
		string s;
		cin >> s;
		int c = 0;
		for (int i = 0; i < s.size(); i++) {
			for (int j = sz - 1; j >= 0; j--) {
				if (aa[j] == s[i]) {
					cout << aa[j - k[c]];
					c++;
					c %= n;
					break;
				}
			}
		}
		cout << endl;
	}
	return 0;
}

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

int N, K[100];
string S;

int main(void) {
  while(cin >> N, N) {
    REP(i, 0, N) cin >> K[i];
    cin >> S;

    string ans = "";
    REP(i, 0, S.length()) {
      char c = S[i];
      if('a' <= c && c <= 'z') {
        c = S[i] - K[i % N];
        if(c < 'a') c = 'Z' + 1 + c - 'a';
      } else {
        c = S[i] - K[i % N];
        if(c < 'A') c = 'z' + 1 + c - 'A';
      }
      ans += c;
    }
    cout << ans << endl;
  }
}

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

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

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

char i2c(int i) {
    if(0 <= i && i < 26) return 'a' + i;
    if(26 <= i && i < 52) return 'A' + i - 26;
    assert(false);
}

int c2i(char c) {
    if('a' <= c && c <= 'z') return c - 'a';
    if('A' <= c && c <= 'Z') return c - 'A' + 26;
    assert(false);
}

char rev_c(char c, int r) {
    int num = c2i(c);
    num -= r;
    (num += 52) %= 52;
    return i2c(num);
}

bool solve() {
    int N;
    cin >> N;
    if(!N) return false;

    vector<int> K(N);
    for(int &e : K) cin >> e;

    string S;
    cin >> S;

    for(int i = 0; i < S.size(); i++) {
        int k = K[i % K.size()];
        cout << rev_c(S[i], k);
    }
    cout << endl;
    return true;
}

int main() {
    while(solve());
    return 0;
}

C++: #include<iostream>
#include<vector>
#include <unordered_map>  
#include <algorithm>
#include <functional>
#include <map>
#include <string>
#include <sstream>
#include <cmath>
#include <float.h>
using namespace std;

void A();
void B();

int main() {
	unsigned int n, key[100], key_pos = 0;
	string s;
	cin >> n;
	while (n != 0) {
		for (unsigned int i = 0; i < n; ++i) {
			cin >> key[i];
		}
		cin >> s;
		key_pos = 0;
		for (unsigned int i = 0; i < s.length(); ++i) {
			char tmp = s[i] - key[key_pos];
			if (tmp < 'A') tmp = 'z' - (key[key_pos] - (s[i] - '@'));
			if (tmp > 'Z' && tmp < 'a') tmp -= 6;
			++key_pos;
			if (key_pos >= n) key_pos = 0;
			cout << tmp;
		}
		cout << endl;
		cin >> n;
	}
	return 0;
}

void A() {
	
}

C++: #include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
using namespace std;
int main() {
	int n;
	while (cin >> n&&n != 0) {
		int a[100];
		for (int i = 0; i < n; i++) cin >> a[i];
		string s, h = "";
		cin >> s;
		int k = 0;
		for (int i = 0; i < s.length(); i++) {
			char e = s[i];
			for (int j = 0; j < a[k]; j++) {
				if (e == 'a') e = 'Z';
				else if (e == 'A') e = 'z';
				else e--;
			}
			h += e;
			k++;
			if (k == n) k = 0;
		}
		cout << h << endl;
		h = "";
	}
}

C++: #include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

#define INF 1000000000
#define EPS 1e-9
#define PI acos(-1)

typedef long long ll;

#define MAX_N 100

int n;
int k[MAX_N];
string s;
string str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";

vector<string> ans_list;

int main(){

  while(true){
    cin >> n;
    if(n == 0)
      break;
    for(int i = 0; i < n; i++){
      cin >> k[i];
    }
    cin >> s;
    string ans;
    int num = 0;
    for(int i = 0; i < s.length(); i++, num++){
      if(num == n)
	num = 0;
      int tmp;
      for(tmp = 0; tmp < 52; tmp++){
	if(str[tmp] == s[i])
	  break;
      }
      tmp -= k[num];
      if(tmp < 0)
	tmp += 52;
      ans += str[tmp];
    }
    ans_list.push_back(ans);
  }

  for(int i = 0; i < ans_list.size(); i++){
    cout << ans_list[i] << endl;
  }

  return 0;

}