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 <algorithm>

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pii;

#define dump(x)  cerr << #x << " = " << (x) << endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(x) x.begin(),x.end()

char sub(char ch,int x){
    x=x%52;
    if(x>=26){
        x-=26;
        if('a'<=ch && ch<='z')ch+=('A'-'a');
        else if('A'<=ch && ch<='Z')ch+=('a'-'A');
    }

    if('a'<=ch && ch<='z'){
        if(ch-x<'a')return ('Z'+1-('a'-(ch-x)));
    }else{
        if(ch-x<'A')return ('z'+1-('A'-(ch-x)));
    }
    return ch-x;
}

int main(){
    int n;
    while(cin>>n){
        vi key;
        if(n==0)return 0;
        rep(i,n){
            int tmp;
            cin>>tmp;
            key.pb(tmp);
        }
        string s;
        cin>>s;
        int len=s.size();
        rep(i,len){
            cout<<sub(s[i],key[i%key.size()]);
        }
        cout<<endl;
        
        
    }
    
    return 0;
}

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

using namespace std;



int main() {
	int n;
	while (cin >> n, n) {
		vector<int> k(n);
		for (int i = 0; i < n; ++i) cin >> k[i];
		string s; cin >> s;
		int now = 0;
		for (int c : s) {
			if (isupper(c)) {
				c -= 'A';
				(c -= k[now] - 52) %= 52;
				if (c >= 26) c = (c % 26) + 'a';
				else c += 'A';
			} else {
				c -= 'a';
				(c -= k[now] - 52) %= 52;
				if (c >= 26) c = (c % 26) + 'A';
				else c += 'a';
			}
			cout << (char)c;
			(now += 1) %= n;
		}
		cout << endl;
	}

	return 0;
}

C++: #include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
using namespace std;
int main() {
	int n;
	while (cin >> n&&n != 0) {
		int a[100];
		for (int i = 0; i < n; i++) cin >> a[i];
		string s, h = "";
		cin >> s;
		int k = 0;
		for (int i = 0; i < s.length(); i++) {
			char e = s[i];
			for (int j = 0; j < a[k]; j++) {
				if (e == 'a') e = 'Z';
				else if (e == 'A') e = 'z';
				else e--;
			}
		}
		cout << h << endl;
		h = "";
	}
}

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <string>
#include <cstdio>
#include <cmath>
#include <map>
using namespace std;

int main()
{
	char a[53];
	for (int i = 0; i < 26; ++i)
	{
		a[i] = (char)('A' + i);
	}
	for (int i = 0; i < 26; ++i)
	{
		a[26 + i] = (char)('a' + i);
	}
	int n;
	int k[100];
	char s[101];
	while(cin >> n && n != 0){
		int c = 0;
		for (int i = 0; i < n; ++i)
		{
			cin >> k[i];
		}
		k[n] = '\0';
		cin >> s;
		for (int i = 0; s[i] != '\0'; ++i)
		{
			for (int j = 0; j < 52; ++j)
			{
				if(s[i] == a[j]){
					if(j - k[c] >= 0){
						cout << a[j - k[c]];
					}else{
						cout << a[52 - k[c] + j];
					}
				}
			}
		}
		c++;
		if(c == n){
			c = 0;
		}
		cout << endl;
	}
}

C++: #include <iostream>
using namespace std;
int main(){
  int n,c=0,k,i;
  string s;
  while(cin>>n,n){
    int a[n];
    for(i=0;i<n;i++)cin>>a[i];
    cin>>s;
  for(i=0;i<s.size();i++){
    k=a[c++%n];
    if(int(s[i])-k>90&&int(s[i])-k<97)s[i]=s[i]-k-6;    
    else if(int(s[i])-k<65)s[i]='{'-k;
    else s[i]=s[i]-k;
  }
  cout<<s<<endl;
  }
}

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<iostream>
using namespace std;
int main(){
  while(1){
  int n,m[101],j,s;
  char st[52];
  string str,ans;
  for(int i=1;i<27;i++) st[i]='A'+i-1;
  for(int i=27;i<53;i++)st[i]='a'+i-27;
  cin>>n;
  if(n==0)break;
   for(int i=0;i<n;i++)cin>>m[i];
  cin>>str;
  j=0;
  for(int i=0;i<str.size();i++){
    if(str[i]>='A' && str[i]<='Z') s=str[i]-'A'+1;
    else s=str[i]-70;
        s-=m[j];
	if(s<=0) s+=52;
	ans+=st[s],j++;    
    if(j>n-1) j=0;
  }
  cout<<ans<<endl;
  }
    return 0;
}