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 <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>

#define CH(N,A,B) (A<=N&&N<B)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define RREP(i,a,b) for(int i=(b-1);a<=i;i--)
#define F first
#define S second

using namespace std;
int n,key[110];
string s;
char alp[52] = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',
              'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};

int main() {
  while(1){
    cin>>n;
    if(n==0) break;
    REP(i,0,n) cin>>key[i];
    cin>>s;
    REP(i,0,s.size()){
      int pos=-1;
      REP(j,0,52){
        if(alp[j]==s[i]){
          pos = j;
          break;
        }
      }
      cout<<alp[(pos - key[i%n] + 52*10000)%52];
    }
    cout<<endl;
  }
  return 0;
}

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

using namespace std;

int n;
int k[110];
string s;
map< char, int > cmap;
char c[55];

char parse(const char s, int k) {
	int p = cmap[s];
	p = (p-k+52)%52;
	return c[p];
}

void solve() {
	int size = (int)s.size();
	for (int i=0; i<size; i++) {
		s[i] = parse(s[i], k[i%n]);
	}
	cout << s << endl;
}

int main() {
	for (int i=0; i<26; i++) cmap['a'+i] = i;
	for (int i=0; i<26; i++) cmap['A'+i] = 26+i;
	for (int i=0; i<26; i++) c[i] = 'a' + i;
	for (int i=0; i<26; i++) c[26+i] = 'A' + i;
	
	while (1) {
		cin >> n; if ( n==0 ) break;
		for (int i=0; i<n; i++) cin >> k[i];
		cin >> s;
		solve();
	}
	
	return 0;
}

C++: #include <iostream>
#include <map>

using namespace std;

#define MN 101

int n;
int ks[MN];
string raw;

map<char, int> kmap;
map<int, char> rkmap;

void init_() {
    for (char i = 'a'; i <= 'z'; i++) {
        kmap[i] = i - 'a';
        rkmap[i - 'a'] = i;
    }
    for (char i = 'A'; i <= 'Z'; i++) {
        kmap[i] = i - 'A' + 26;
        rkmap[i - 'A' + 26] = i;
    }
}

bool init() {
    cin >> n;
    if (n == 0) return false;
    for (int i = 0; i < n; i++) {
        cin >> ks[i];
    }
    cin >> raw;
    return true;
}

char before(char r, int b) {
    int i = kmap[r];
    return rkmap[(i + 52 - b) % 52];
}

void solve() {
    string ans = raw;
    int kindex = 0;
    for (int i = 0; i < raw.size(); i++) {
        ans[i] = before(raw[i], ks[kindex]);
        kindex = (kindex + 1 + n) % n;
    }
    cout << ans << endl;
}

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

C++: #define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f

#include <iostream>
#include <cstdio>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
  
using namespace std;
  
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P> PP;
  
static const double EPS = 1e-8;
  
static const int tx[] = {0,1,0,-1};
static const int ty[] = {-1,0,1,0};

static const string stations = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";

int main(){

  int n;
  while(~scanf("%d",&n)){
    if(n==0) break;

    int back_dist[101];
    for(int i=0;i<n;i++){
      scanf("%d",back_dist+i);
    }
    string str;
    cin >> str;

    int back_idx = 0;
    for(int i=0;i<str.size();i++){
      int pos = lower_bound(stations.begin(),stations.end(),str[i]) - stations.begin();
      str[i] = stations[(pos - back_dist[back_idx] + stations.size()) % stations.size()];
      back_idx++;
      back_idx %= n;
    }

    cout << str << endl;
  }
}

C++: #include <bits/stdc++.h>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define itrep(i,x) for(auto i=(x).begin(); i!=(x).end();i++)
#define Sort(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define vi vector<int>
#define INF (int)1e9
#define INFL 1e18
#define MOD 1000000007
#define pb push_back
#define MP make_pair
#define PI 3.1415926535
typedef long long int ll;
typedef std::pair<int,int> P;
int D=1;
int dx[4]={0,1,0,-1},dy[4]={-1,0,1,0};

using namespace std;

int main(){
    int n;
    vector<char> alp;
    rep(i,0,26)alp.pb('a'+i);
    rep(i,0,26)alp.pb('A'+i);
    //alp={'a','b'.......'Y','Z'}
    while(cin>>n){
        if(n==0)break;
        vector<int> v(n);
        rep(i,0,n)cin>>v[i];
        string s;
        cin>>s;
        
        int v_count=0; 
        //v_countはずらす回数を表す数字の配列の添字
        //下に出てくるposは'a'-'Z'までを格納した配列alpの添字
        
        rep(i,0,s.size()){
            if('a'<=s[i]&&s[i]<='z'){
                int pos=s[i]-'a';  //小文字の時、'a'との差がalpの添字
                rep(j,0,v[v_count]){
                    pos--;
                    if(pos==-1)pos=51;
                }
                cout<<alp[pos];
            }else {
                int pos=s[i]-'A'+26; //大文字の時、'A'との差に26を足さないとalpの添字にならない
                rep(j,0,v[v_count]){ 
                    pos--;
                    if(pos==-1)pos=51;
                }
                cout<<alp[pos];
            }
            v_count++;
            if(v_count==n)v_count=0;
        }
        cout<<endl;
    }
    
    return 0;
}