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 <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;
				if(temp >= 26){
					temp -= 26;
					c = 'z' - temp + 1;
					cout << c;
				}
				else{
					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;
				if(temp >= 26){
					temp -= 26;
					c = 'Z' - temp + 1;
					cout << c;
				}
				else{
					c = 'z' - temp + 1;
					cout << c;
				}
			}
			else{
				c = s[i] - keys[i];
				cout << c;
			}
		}
	}
	cout << endl;

}//end

	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int conv1(char c){
  if ('a' <= c && c <= 'z'){
    return c - 'a';
  }
  if ('A' <= c && c <= 'Z'){
    return c - 'A' + 26;
  }
}
char conv2(int x){
  if (x < 26){
    return x + 'a';
  } else {
    return x - 26 + 'A';
  }
}
int main(){
  while (1){
    int n;
    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 m = s.size();
    for (int i = 0; i < m; i++){
      s[i] = conv2((conv1(s[i]) - k[i % n] + 52) % 52);
    }
    cout << s << endl;
  }
}

C++: #include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<string>
#include<cstring>
#include<cstdlib>
#include<cctype>
#include<bitset>
#include<functional>
#include<climits>
using namespace std;
typedef pair<int,int>pii;
const int INF=1e9;
const int dx[]={0,-1,0,1},dy[]={-1,0,1,0};


int main(){
    int n;
    while(cin>>n,n){
        int a[100];for(int i=0;i<n;i++)cin>>a[i];
        char str[128];cin>>str;
        for(int i=0;str[i];i++){
            int val=(isupper(str[i])?tolower(str[i])-'a'+26:str[i]-'a');
            int next=val-a[i%n];
            next=(next+52)%52;
            if(next>25)next=toupper('a'+next-26)-'a';
            printf("%c",'a'+next);
        }
        puts("");
    }
    return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;
char T[53] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; int 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 - t[i%n]];
				}
			}
		}
		cout << U << endl;
	}
}

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

char decodeChar(char c,int n)
{
  rep(i,n)
    {
      if(c == 'a')
	{
	  c = 'Z';
	  continue;
	}
      if(c == 'A')
	{
	  c = 'z';
	  continue;
	}
      c = (char)(c-1);
    }
  return c;
}

int main()
{
  int n;
  while(cin >> n,n)
    {
      vector<int> vec(n);
      rep(i,n) cin >> vec[i];
      string message;
      cin >> message;
      for(int i=0,index=0;i<message.size();i++,index=(index+1)%n)
	cout << decodeChar(message[i],vec[index]);
      cout << endl;
    }
  return 0;
}

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

using std::cin;
using std::cout;
using std::endl;

char encode(char c, int n) {
	char ret = c;
	for (int i = 0; i < n; i++) {

		if (ret == 'a') {
			ret = 'Z';
		}
		else if (ret == 'A') {
			ret = 'z';
		}
		else {
			ret -= 1;
		}
	}
	return ret;
}

int main(void) {
	int n;
	cin >> n;

	while (n != 0) {
		std::vector<int> k(n);
		std::string str;
		for (int i = 0; i < n; i++) {
			cin >> k[i];
		}
		
		cin >> str;

		for (int i = 0; i < str.length(); i++) {
			cout << encode(str[i], k[i%n]);
		}
		cout << endl;

		cin >> n;
	}

	return 0;
}

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

int main(){
  vector<char> station(52);
  for(int i = 0;i < 26;i++){
	station[i] = 'a'+i;
  }
  for(int i = 26;i < 52;i++){
	station[i] = 'A'+i - 26;

  }
  
  int n;
  while(cin >> n && n){
	vector<int> key(n,0);
	for(int i = 0;i < n;i++){
	  cin >> key[i];
	}
	string str;
	cin >> str;
	int key_cnt = 0;
	for(int i = 0;i < str.size();i++){
	  if(key_cnt == key.size())key_cnt = 0;
	  int c = 0;
	  for(int j = 0;j < station.size();j++){
		if(station[j] == str[i]){
		  c = j;
		  break;
		}
	  }

	  if(c-key[key_cnt] < 0)cout <<  station[c-key[key_cnt]+52];
	  else cout << station[c-key[key_cnt]];
	  key_cnt++;
	}
	cout << endl;
  }
  
  
  return 0;
}