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++: #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,n) for(int i=0;i<n;i++)
using namespace std;

int main(){
	int n,k[100];
	string s;
	while(cin>>n,n){
		rep(i,n) cin>>k[i];
		cin>>s;
		rep(i,s.size()){
			char a;
			int S=s[i],K=k[i%n];
			if('a'<=S&&S<='z'){
				if('a'<=S-K&&S-K<='z'){
					a=S-K;
				}else if(S-K<'a'){
					a='Z'+1-'a'+S-K;
				}else{
					a='A'-1+S-K-'z';
				}
			}else{
				if('A'<=S-K&&S-K<='Z'){
					a=S-K;
				}else if(S-K<'A'){
					a='z'+1-'A'+S-K;
				}else{
					a='a'-1+S-K-'Z';
				}
			}
			cout<<a;
		}
		cout<<endl;
	}
}

C++: #include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
int main(){
	char data[53];
	for(int i=0;i<26;i++){
		data[i]='A'+i;data[i+26]='a'+i;
	}
	int n,k;
	string s;
	while(cin>>n,n){
		int k[100];
		for(int i=0;i<n;i++)cin>>k[i];
		cin>>s;
		int a[100];
		for(int i=0;i<s.size();i++){
			if(s[i]>='a')a[i]=26+(s[i]-'a');
			else a[i]=s[i]-'A';
			int t=a[i]-k[i%n];
			if(t<0)t+=52;
			cout<<data[t];
		}
		cout<<endl;
	}
}

C++: #include<bits/stdc++.h>
using namespace std;
int main()
{

  while(true)
  {
    int n;
    string s;
    string t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
    string ans;
    int k[300]={0};
    cin>>n;
    if(n==0)
    {
      break;
    }
    for(int i=0;i<n;i++)
    {
      cin>>k[i];
    }
    cin>>s;
      int G=s.size();
      for(int i=n;i<G;i++)
      {
        k[i]=k[i-n];
      }

    for(int b=0;b<G;b++)
    {
      for(int i=0;i<52;i++)
      {
        if(s[b]==t[i])
        {
          if(i-k[b]<0)
          {
            ans+=t[52+(i-k[b])];
          }else{
            ans+=t[i-k[b]];
          }
        }
      }
    }
cout<<ans<<endl;
  }
  return 0;
}