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 <cstdio>
#include <cstdlib>
#include <string>

using namespace std; 

string list = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";

int main()
{
 int n, l, p;
 string s, ans;

 while(cin >> n){
	if(n==0){return 0;} ans = "";
	int* key = new int[n];
	for(int i=0; i<n; i++){cin >> key[i];}
	cin >> s; l=s.length();
	for(int i=0; i<l; i++){
		p = list.find(s.substr(i,1))-key[i%n];
		if(p<1){p+=104;p=p%52;}
		ans += list.substr(p,1);
	}
	cout << ans << endl; delete[] key;
 }
}

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

int main(){
	// f[i] := 数値 i に対応する文字を返す('a'..'z' or 'A'..'Z')
	char f[100];
	// g[c] := 文字 c に対応する数値を返す(0..51)
	int g[256];
	// 文字の対応を最初に作っておく
	for(int i = 0 ; i < 26 ; i++ ){
		f[i] = 'a' + i;
		g['a' + i] = i;
	}
	for(int i = 0 ; i < 26 ; i++ ){
		f[i + 26] = 'A' + i;
		g['A' + i] = i + 26;
	}
	
	int n, k[101];
	string s;
	while( cin >> n , n ){
		for(int i = 0 ; i < n ; i++ ) cin >> k[i];
		cin >> s;
		
		string t = s;
		for(int i = 0 ; i < s.size() ; i++ ){
			int a = (g[s[i]] - k[i % n] + 52) % 52;
			t[i] = f[a];
		}
		cout << t << endl;
	}
}

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

int key[1000];
char alpha[100];
int main(){
  int n,j;
  string s;
  int k=0;
  for(int i=0;i<52;i++){
    if(i>=26)
      alpha[i] = 'A'+i+6;
    else  alpha[i] = 'A'+i;
  }
  //cout<<(int)'A'<<(int)'a'<<endl;
  while(cin>>n,n){
    string ans;
    k = 0;
    j = 0;
    for(int i = 0;i<n;i++)cin>>key[i];
    cin>>s;
    // cout<<s<<endl;
    for(int i = 0;i<s.length();i++){
      if(s[i]>'a')
	s[i] -= 6;
      if(s[i]-key[j]-'A'>=0)
	ans[i] = alpha[s[i] - key[j]-'A'];
      else{

	ans[i] = alpha[s[i]-key[j]-'A'+'z'-'A'-5];
      }
      if(j == n-1) j = 0;
      else j++;
    }
    //    cout<<alpha[51];
    for(int i=0;i<s.length();i++)
      cout<<(char)ans[i];
    cout<<endl;
  }
  return 0;
}

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

char ch[52];
int n,t[105];
string s;

int main(){
  ch[0]='a';ch[26]='A';
  for(int i=1;i<26;i++){
    ch[i]=ch[i-1]+1;
    ch[i+26]=ch[i+25]+1;
  }
  while(1){
    cin>>n;
    if(n==0)break;
    for(int i=0;i<n;i++)cin>>t[i],t[i]%=52;
    cin>>s;
    for(int i=0;i<(int)s.size();i++){
      int j=i%n;
      int a=('a'<=s[i]?s[i]-'a':s[i]-'A'+26);
      a=(a+52-t[j])%52;
      cout<<ch[a];
    }
    cout<<endl;
  }
  return 0;
}

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

#define loop(n, i) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define HERE cout << "HERE: " << __LINE__ << endl;
#define INSP(v) cout << v << " at " << __LINE__ << endl;

using namespace std;
typedef long long ll;


int main()
{
    vector<char> list(52, 0);
    char c = 'a';
    loop(26,i) list[i] = c+i;
    c = 'A';
    for(int i = 26; i<52; i++) list[i] = c+i-26;

    int n;
    while (cin >> n, n) {
        vector<int> k(n, 0);
        loop(n, i) cin >> k[i];
        string s; cin >> s;
        string ans = "";
        int ite = 0;
        for (auto c : s) {
            int i = distance(list.begin(), find(all(list), c));
            ans += i-k[ite] < 0 ?
                list[i-k[ite]+52] : list[i-k[ite]];
            ite = n==++ite? 0 : ite;
        }
        cout << ans << endl;
    }
}

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

int main(){
  int a,b,c;
  string s,h="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
  queue<int> q;
  while(1){
    cin>>a;
    if(a==0)break;
    while(q.size()!=0)q.pop();
    for(int i=0;i<a;i++){
      cin>>b;
      q.push(b);
    }
    cin>>s;
    for(int i=0;i<s.size();i++){
      if('a'<=s[i]&&s[i]<='z')c=s[i]-'a';
      else if('A'<=s[i]&&s[i]<='Z')c=s[i]-'A'+26;
      //cout<<c<<" ";///////////
      c-=q.front();
      //cout<<c<<endl;///////////
      if(c<0)c=h.size()+c;
      q.push(q.front());q.pop();
      cout<<h[c];
    }
    cout<<endl;
  }
  return 0;
}

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <cmath>

using namespace std;


int main(){

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


  while(1){

    cin>>n;
    if(!n)
      break;

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

    cin>>s;

    int count = -1;

    for(int i = 0; i < s.size(); i++){
      int a;
      count++;
      count = count % n;
      for(int j = 0; j < 52; j++){
	if(s[i] == str[j]){
	  a = j;
	}
      }
      a += 104;
      //cout<<"a= "<< a << endl;
      //cout<<"k= "<< k[count] << endl;
      //cout<<"a - k= "<< a - k[count] << endl;
      cout << str[(a - k[count]) % 52];
    }
    cout<<endl;

  }
  return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double ESP=1e-10;
using namespace std;
string tmp="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
int main(){
  tmp+=tmp;
  int n;
  while(cin>>n,n){
    vector<int>in(n);
    rep(i,n)cin>>in[i];
    string out;
    cin>>out;
    rep(i,out.size()){
      int co=0;
      int count=0;
      rep(j,tmp.size()){
	co=j;
	if(tmp[j]==out[i])count++;
	if(count==2)break;
      }
      out[i]=tmp[co-in[i%n]];
    }
    cout<<out<<endl;
  }
}