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 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 l = s.size();
    for(int i = 0; i < l; ++i){
      char t;
      if(s[i] >=  'a' && s[i] <= 'z' && s[i] - k[i%n] >= 'a') t = s[i] - k[i%n];
      else if(s[i] >=  'A' && s[i] <= 'Z' && s[i] - k[i%n] >= 'A') t = s[i] - k[i%n];
      else {
	//if(s[i] >= 'a' && s[i] <= 'z') t = 'Z' - 1 - s[i] + k[i%n] + 'a';
	if(s[i] >= 'a' && s[i] <= 'z') t = 'Z' + 1 + s[i] - k[i%n] - 'a';
	//else t = 'z' - 1 - s[i] + k[i%n] + 'A';
	else t = 'z' + 1 + s[i] - k[i%n] - 'A';
      }
      cout << t;
    }
    cout << endl;
  }
  return 0;
}

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


int main(){
  int n;
  while(cin>>n,n){
    int key[101];
    for(int i=0;i<n;i++) cin>> key[i];
    string str;
    cin>>str;

    int idx=0;
    for(int i=0;i<str.size();i++){
      idx%=n;
      int flg=0;
      if(key[idx]>=26)flg=1;
      char ch=str[i];
      str[i]-=key[idx++]%26;
    
      if(str[i]<'A') str[i]='z'-('A'-str[i])+1;
      else if('a'<=ch&&str[i]<'a') str[i]='Z'-('a'-str[i])+1;

      if(flg&&'a'<=str[i]&&str[i]<='z') str[i]-=32;
      else if(flg) str[i]+=32; 
    }
    cout <<str<<endl;
  }
  return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <complex>
using namespace std;

#define ll long long
#define vvi vector< vector<int> >
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back 
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

vector<char> cmap;
char getrev(char c,int kagi){
	int rst;
	if(c>='a') rst = c -'a' ;
	else rst = c - 'A'+ ('Z'-'A'+1);
	if(rst-kagi<0) return cmap[rst-kagi+cmap.size()];
	else return cmap[rst-kagi];
}
int main(){
	for(int i='a';i<'z'+1;i++) cmap.pb(i);
	for(int i='A';i<'Z'+1;i++) cmap.pb(i);

	while(1){
		int n;
		cin >> n;
		int klist[100];
		REP(i,n){
			cin >> klist[i];
		}
		string ango;
		cin >> ango;
		int nowkagi = 0;
		REP(i,ango.size()){
			cout << getrev(ango[i],klist[nowkagi]);
			if(nowkagi==n-1) nowkagi = 0;
			else nowkagi++;
		}
		cout << endl;
	}
}

C++: #include <iostream>
#include <string>
#define llint long long

using namespace std;

llint n;
llint k[105];
string s;

int main(void)
{
	while(1){
		cin >> n;
		if(n == 0) break;
		for(int i = 0; i < n; i++) cin >> k[i];
		cin >> s;
		
		string ans;
		for(int i = 0; i < s.size(); i++){
			int c = s[i]-'a';
			if(s[i] < 'a') c = s[i]-'A'+26;
			c += 52-k[i%n];
			c %= 52;
			if(c < 26) ans += c+'a';
			else ans += (c-26)+'A';
		}
		cout << ans << endl;
	}
	return 0;
}

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

char solve(char c, int k) {
    k %= 26;
    if (islower(c)) {
        int x = c - k;
        if (x < 'a') {
            return 'Z' - ('a' - x) + 1;
        }
        return x;
    }
    else {
        int x = c - k;
        if (x < 'A') {
            return 'z' - ('A' - x) + 1;
        }
        return x;
    }
}

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

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

int main(void){
    int n;
    while(cin >> n, n){
        int k[110];
        for(int i=0; i<n; i++){
            cin >> k[i];
        }
        string s;
        cin >> s;
        for(int i=0; i<s.size(); i++){
            int p=0;
            if('a'<=s[i]&&s[i]<='z'){
                p=s[i]-'a';
            }
            else{
                p=s[i]-'A'+26;
            }
            p-=k[i%n];
            if(p<0){
                p+=52;
            }
            if(p<26){
                s[i]=p+'a';
            }
            else{
                s[i]=p+'A'-26;
            }
        }
        cout << s << "\n";
        
    }
}