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<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<random>
#include<stack>
#include<queue>
#include<cassert>
using namespace std;
int inf = 1000000000;

char bef(char c, int n){
  string alp = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";

  for(int i=0; i<alp.size(); i++){
    if( alp[i] == c ){
      if( i - n < 0 ) i += 52;
      return alp[i-n];
    }
  }
  return c;
}

int main(void) {

  int n;
  while(cin >> n){
    if( n == 0 ) break;
    vector<int> k(n);
    for(int i=0; i<n; i++) cin >> k[i];
    string s;
    cin >> s;

    string ans = "";
    for(int i=0; i<s.size(); i++){
      ans += bef(s[i], k[i%n]);
    }
    cout << ans << endl;
  }




  return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <cmath>
#include <algorithm>
#include <functional>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define rep1(i,n) for(int i=1;i<=(n);++i)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
char tochar(int x){
	if(x<26) return 'a'+x;
	return 'A'+(x-26);
}
int toint(char c){
	if('a'<=c&&c<='z') return c-'a';
	else return c-'A'+26;
}
int main(){
	while(true){
		int n,a[100];
		cin>>n;
		if(n==0) break;
		rep(i,n) cin>>a[i];
		string s;
		cin>>s;
		rep(i,s.size()) s[i]=tochar((toint(s[i])-a[i%n]+52)%52);
		cout<<s<<endl;
	}
}

C++: #include <iostream>
#include <string>
using namespace std;
int main() {
  int n;
  string s;
  while (cin >> n, n) {
    int K[n];
    for (int i = 0; i < n; ++i) cin >> K[i];
    cin >> s;
    for (int i = 0; i < s.size(); ++i) {
      if (s[i]-K[i%n] < 'A' && s[i] >= 'A') s[i] = 'z' - 'A' - K[i%n] + s[i] + 1;
      else if (s[i]-K[i%n] < 'a' && s[i] >= 'a') s[i] = 'Z' - 'a' - K[i%n] + s[i] + 1;
      else s[i] -= K[i%n];
    }
    cout << s << endl;
  }
  return 0;
}

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

#define KEY_NUM 100

char process_key(char c, int key) {
    
    int num=0;
    //cout << "[" << c << "," << key << "," << num << "]";
    if ('a' <= c && c <= 'z') {
        num = 25 - (int)('z' - c);
    }
    if ('A' <= c && c <= 'Z') {
        num = 51 - (int)('Z' - c);
    }
    num = (num - key + 104) % 52;
    if ( 0 <= num && num <= 25) {
        c = 'a' + num;
    }
    if (26 <= num && num <= 51) {
        c = 'A' + (num - 26);
    }
    //cout << "[" << c << "," << key << "," << num << "]";
    return c;
}

int main(void) {
    string s;
    int n;
    int keys[KEY_NUM];
    while (cin >> n, n) {
        for (int i=0; i<n; i++) {
            cin >> keys[i];
        }
        cin >> s;
        //cout << n << endl;
        for (int i=0; i<s.size(); i++) {
            //cout << process_key(s[i], keys[i % n]) << "_";
            cout << process_key(s[i], keys[i % n]);
        }
        //cout << s << endl;
        cout << endl;
    }
}

C++: #include <cstdio>

using namespace std;

int main() {
  int n;
  while (scanf("%d", &n), n!=0) {
    int k[100];
    char s[101];
    for (int i=0;i<n;i++) scanf("%d", &k[i]);
    scanf("%s", s);
    for (int i=0;i<s[i]!='\0';i++) {
      int c = s[i];
      for (int j=0;j<k[i%n];j++) {
        if (c == 'a') c = 'Z';
        else if (c == 'A') c = 'z';
        else c--;
      }
      putchar(c);
    }
    putchar('\n');
  }
  return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  int *ki;
  char *s;
while(1){
  int n;
  s=new char[100];
  cin>>n;
  if(n==0)break;
  k= new int[n+1];
  for(i=1;i<=n;i++)cin>>k[i];
  cin>>s;
  for(i=0;s[i]!=0;i++){
    s[i]-=k[i%n+1];
    if(s[i]<'A')s[i]-='A'-'z'-1;
    else if(s[i]>'Z' && s[i]<'a')s[i]-=6;
  }
  cout<<s<<endl;

  delete s;
  delete k;
}

return 0;
}