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;
  while(cin >> n,n){
    vector<int> v;
    string str;
    for(int i=0; i<n; ++i){
      int tmp;
      cin >> tmp;
      v.push_back(tmp);
    }
    cin >> str;

    int cnt = 0;
    for(int i=0; i<str.size(); ++i){
      char tmp;
      int tmp2 = str[i]-v[cnt];

      
      tmp = str[i] - v[cnt];
      
      if(tmp2<'A'){
	tmp = 'z' - ('A'-tmp2)+1;
      }else if(tmp2<'a' && tmp2 >'_'+1){
	tmp = 'Z' - ('a'-tmp2)+1;
      }

     
      
      cout << tmp;
      ++cnt;
      if(cnt>=v.size())cnt = 0;
    }
    cout << endl;
  }
  return 0;
}

C++: #include <cstdio>

using namespace std;

int main() {
  int n;
  while (scanf("%d", &n), n!=0) {
    int k[100];
    char s[101];
    for (int i=0;i<n;i++) scanf("%d", &k[i]);
    scanf("%s", s);
    for (int i=0;s[i]!='\0';i++) {
      int c = s[i];
      for (int j=0;j<k[i%n];j++) {
        if (c == 'a') c = 'Z';
        else if (c == 'A') c = 'z';
        else c--;
      }
      putchar(c);
    }
    putchar('\n');
  }
  return 0;
}

C++: #include <bits/stdc++.h>
#define range(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i, a) range(i, 0, a)
using namespace std;

int main() {
	int n;
	map <int, int> mp;
	rep (i, 52 * 2) {
		if (i < 26) {
			mp[i] = 'a' + i;
		} else if (i < 52) {
			mp[i] = 'A' + 26 - (52 - i);
		} else if (i < 26 * 3) {
			mp[i] = 'a' + 26 - (26*3 - i);
		} else {
			mp[i] = 'A' + 26 - (26*4 - i);
		}
	}

	while (cin >> n, n) {
		vector <int> k(n);
		rep (i, n) cin >> k[i];
		string s;
		cin >> s;
		string out = "";

		rep (i, s.size()) {
			int tmp;
			if ('a' <= s[i] && s[i] <= 'z') tmp = 52 + s[i] - 'a';
			else tmp = s[i] - 'A' + 78;
			out.push_back((char)mp[tmp - k[i%n]]);
		}
		cout << out << endl;
	}
	return 0;
}

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

vector<int> keys;

int main(){
while(1){//start

	//init
	keys.clear();

	int n;
	cin >> n;
	if(n == 0) break;
	for(int i = 0; i < n; i++){
		int temp;
		cin >> temp;
		keys.push_back(temp);
	}

	//extend keys
	for(int i = 0; i < 200; i++){
		int temp = keys[i];
		keys.push_back(temp);
	}

	string s;
	cin >> s;
	for(int i = 0; i < (int)s.size(); i++){
		char c;
		if(islower(s[i])){
			int now_num = s[i] - 'a';
			if(now_num - keys[i] < 0){
				int temp = keys[i] - now_num;
				c = 'Z' - temp + 1;
				cout << c;
			}
			else{
				c = s[i] - keys[i];
				cout << c;
			}
		}
		else if(isupper(s[i])){
			int now_num = s[i] - 'A';
			if(now_num - keys[i] < 0){
				int temp = keys[i] - now_num;
				c = 'z' - temp + 1;
				cout << c;
			}
			else{
				c = s[i] - keys[i];
				cout << c;
			}
		}
	}
	cout << endl;

}//end

	return 0;
}

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 <stack>
#include <queue>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <string>
using namespace std;


int n;
int key[110];
string str;

char x[60];

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

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

    cin >> str;

    string a = "a";

    for(int i = 0,j = 0; i < str.size() ; i++,j++){
      if(i % n == 0) j = 0;
      
      char tmp = str[i] - key[j]; 
   
      if(str[i] - key[j] < 'A' ){
	str[i] += 52 + 6;
      }
      if(str[i] >= 'a' && str[i] - key[i] < 'a') str[i] -= 6;
      str[i] -= key[j];
    }
      cout << str << endl;
  }



  return 0;
}

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

#define REP(i,n) for(int i=0;i<(int)(n);i++)

using namespace std;

int main() {
  string sta;
  REP(i,26) sta += 'a' + i;
  REP(i,26) sta += 'A' + i;
  while(1){
    int n;
    cin>>n;
    if(!n)break;
    vector<int> lst(n);
    REP(i,n) cin>>lst[i];
    string s;
    cin>>s;
    int m=s.size();
    REP(i,m) {
      int ind = find(begin(sta),end(sta),s[i]) - begin(sta);
      ind += 52 - lst[i%n];
      ind %= 52;
      cout << sta[ind];
    }
    cout<<endl;
  }
  return 0;
}