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>
using namespace std;
#include<vector>

int main(){
  while(1){
    int n;
    cin>>n;
    int a;
    if(n==0)break;
    vector<int> k(n);
    string s;
    for(int i=0;i<n;i++)cin>>k[i];
    cin>>s;
    for(int i=0;i<s.size();i++){
      if(k[i]<=26){
        a=s[i]-k[i%k.size()];
        if(a<65&&s[i]>=65){
           a+=58;
         }else{
           if(a<97&&s[i]>=97)a-=6;
         }
      }else{
        a=s[i]+(52-k[i%k.size()]);
        if(a>122&&s[i]>=122&&s[i]>=97){
          a-=58;
        }else{
          if(a>90&&s[i]<=90&&s[i]>=65)a+=6;
        }
      }
      putchar(a);
    }
    cout<<endl;
  }
  return 0;
}

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

#pragma warning(disable : 4996)

using namespace std;

int n, k, r[100]; string S;

const string T = "abcdefghijklmnpoqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnpoqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";

int main()
{
	while (true)
	{
		scanf("%d", &n);

		if (n == 0) break;

		for (int i = 0; i < n; i++)
		{
			scanf("%d", &r[i]);;
		}

		cin >> S;

		for (int i = 0; i < S.size(); i++)
		{
			int key;

			for (int j = 52; j < 104; j++)
			{
				if (S[i] == T[j]) key = j;
			}

			key -= r[i % n]; S[i] = T[key];
		}

		cout << S << endl;
	}

	return 0;
}

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

char byte_minus(char ch, int num)
{
  if ( 97 <= ch && ch <= 122 )
  {
    if ( ch - 97 >= num )
    {
      return ch - num;
    }
    else
    {
      return byte_minus('Z', num - (ch - 96) );
    }
  }
  else
  {
    if ( ch - 65 >= num )
    {
      return ch - num;
    }
    else
    {
      return byte_minus('z', num - (ch - 64) );
    }
  }
}

int main()
{
  while (true)
  {
    int n;
    cin >> n;
    if ( n == 0 ) break;
    int* keys = new int[n];
    for (int i = 0; i < n; i++)
    {
      cin >> keys[i];
    }
    string cipher;
    //getline(cin, cipher);
    cin >> cipher;
    for (int i = 0, size = cipher.length(); i < size; i++)
    {
      int key_index = i % n;
      char result = byte_minus(cipher[i], keys[key_index]);
      cout << result;
    }
    cout << endl;
  }
  return 0;
}

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

using namespace std;

int main()
{
  string stt = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
  int n;
  while(cin >> n, n){
    int k[101];
    for(int i = 0; i < n; i++) cin >> k[i];
    string s;
    cin >> s;
    for(int i = 0; i < s.size(); i++){
      int idx = stt.find(s[i]);
      cout << stt[(idx + stt.size() - k[i%n]) % stt.size()];
    }
    cout << endl;
  }
  return 0;
}

C++: #include <bits/stdc++.h>
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; 
    vector<char> c;

    for(int i=0;i<s.size();++i){
      c.emplace_back(s.at(i));
      if(c[i]>='A'&&c[i]<='Z'){
        c[i] -= k[i%k.size()];
        if(c[i]<'A'){
          char div = 'A' - c[i] - 1;
          c[i] = 'z' - div;
        }
      }
      else if(c[i]>='a'&&c[i]<='z'){
        c[i] -= k[i%k.size()];
        if(c[i]<'a'){
          char div = 'a' - c[i] - 1;
          c[i] = 'Z' - div;
        }
      }
      cout<<c[i];
    }
    cout<<endl;
  }

  return EXIT_SUCCESS;
}

C++: #include <stdio.h>

int main(void){
	int n, a[100], i, j;
	char c, s[53] = {"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"};
	while(1){
		scanf("%d",&n);
		if(!n) break;
		for(i = 0;i < n;i++)
			scanf("%d",&a[i]);
		getchar();
		for(i = 0;(c = getchar()) != '\n';i++){
			for(j = 0;j < 52;j++){
				if(s[j] == c)
					printf("%c",s[(52 + j - a[i % n]) % 52]);
			}
		}
		printf("\n");
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <complex>
using namespace std;

#define ll long long
#define vvi vector< vector<int> >
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back 
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

vector<char> cmap;
char getrev(char c,int kagi){
	int rst;
	if(c>='a') rst = c -'a' ;
	else rst = c - 'A'+ ('Z'-'A'+1);
	if(rst-kagi<0) return cmap[rst-kagi+cmap.size()];
	else return cmap[rst-kagi];
}
int main(){
	for(int i='a';i<'z'+1;i++) cmap.pb(i);
	for(int i='A';i<'Z'+1;i++) cmap.pb(i);

	while(1){
		int n;
		cin >> n;
		if(n==0) break;
		int klist[100];
		REP(i,n){
			cin >> klist[i];
		}
		string ango;
		cin >> ango;
		int nowkagi = 0;
		REP(i,ango.size()){
			cout << getrev(ango[i],klist[nowkagi]);
			if(nowkagi==n-1) nowkagi = 0;
			else nowkagi++;
		}
		cout << endl;
	}
}