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<bits/stdc++.h>
using namespace std;

int main(){

  int n;
  while( cin >> n, n ) {
    int k[101];
    for(int i=0; i<n; i++) {
      cin >> k[i];
    }
    string s;
    cin >> s;
  
    int now = 0;
    for(int i=0; i<s.size(); i++) {
      int num = k[now];
      for(int j=0; j<k[now]; j++) {
	s[i]--;
	if( s[i] == 'a'-1 ) {
	  s[i] = 'Z';
	}
	if( s[i] == 'A'-1 ) {
	  s[i] = 'z';
	}
      }
      now++;
      if( now == n ) {
	now = 0;
      }
    }
    
    cout << s << endl;
  }
}

C++: #include<iostream>
#include<vector>
#include <unordered_map>  
#include <algorithm>
#include <functional>
#include <map>
#include <string>
#include <sstream>
#include <cmath>
#include <float.h>
using namespace std;

int main() {
	unsigned int n, key[100], key_pos = 0;
	string s;
	cin >> n;
	while (n != 0) {
		for (unsigned int i = 0; i < n; ++i) {
			cin >> key[i];
		}
		cin >> s;
		key_pos = 0;
		for (unsigned int i = 0; i < s.length(); ++i) {
			char tmp = s[i] - key[key_pos];
			if (tmp < 'A') tmp = 'z' - (key[key_pos] - (s[i] - '@'));
			if (s[i] > 'Z' && tmp < 'a') tmp -= 6;
			++key_pos;
			if (key_pos >= n) key_pos = 0;
			cout << tmp;
		}
		cout << endl;
		cin >> n;
	}
	return 0;
}

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <stdio.h>
using namespace std;
typedef pair<int, int> P;

int main() {
	int j=0,n,s[110],a;
	string b,d="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
	while (1) {
		for (int i = 0; i < 110; i++) {
			s[i] = 0;
		}
		cin >> n;
		if (!n)break;
		j = 0;
		for (int i = 0; i < n; i++) {
			scanf("%d", &s[i]);
			j++;
		}
		cin >> b;
		for (int i = 0; i < b.size(); i++) {
			a=d.find(b[i])- s[i%j];
			if (a < 0)a += 52;
			b[i] = d[a];
		}
		cout << b << endl;
	}
	return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cctype>
#include <numeric>
using namespace std;

#define rep(i,n) for(int (i)=0; (i)<(int)(n); ++(i))
#define foreach(c,i) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)

int N;
int key[102];
string s;

void inc(int& idx) {
  ++idx;
  idx %= N;
}

char chg(char c, int didx) {
  if (islower(c)) {
    if ('a' <= (c - didx))
      return (char)(c - didx);
    return 'Z' - ('a' - (c - didx)) + 1;
  }
  // isupper
  if ('A' <= (c - didx))
    return c - didx;
  return 'z' - ('A' - (c - didx)) + 1;
}

string solve() {
  const int M = s.size();
  string ret = s;
  int idx = 0;
  rep(i,M) {
    ret[i] = chg(s[i], key[idx]);
    printf("src:[%d] dist:[%d] key:[%d]\n", s[i], ret[i], key[idx]);
    inc(idx);
  }
  return ret;
}

int main() {
  while (cin >> N, N) {
    rep(i,N) cin >> key[i];
    cin >> s;
    cout << solve() << endl;
  }
  return 0;
}

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

int main()
{
    int n, l[100];
    char a[52];
    string s;

    for( int i = 0; i < 26; i++ )
        a[i] = 'a' + i;
    for( int i = 26; i < 52; i++ )
        a[i] = 'A' + i - 26;

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

        int j = 0;
        for( int i = 0; i < s.size(); i++ )
        {
            if( 'a' <= s[i] && s[i] <= 'z' )
            {
                if( s[i] - 'a' - l[j] < 0 )
                    s[i] = a[s[i]-'a'+52-l[j]];
                else
                    s[i] = a[s[i]-'a'-l[j]];
            }
            else
            {
                if( s[i] - 'A' + 26 - l[j] < 0 )
                    s[i] = a[52+s[i]-'A'+26-l[j]];
                else
                    s[i] = a[s[i]-'A'+26-l[j]];
            }
            j++;
            if( j == n )
                j = 0;
        }
        cout << s << endl;
    }

    return 0;
}

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

const string alphas = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
const int length = alphas.size();

char cipher(char c, int x) {
  return alphas[(alphas.find(c, 0) + length + x) % length];
}

int main() {
  int n;
  while (cin >> n && n) {
    vector<int> keys(n);
    for (int i = 0; i < n; i++) {
      cin >> keys[i];
    }
    string s;
    cin >> s;
    for (int i = 0, len = s.size(); i < len; i++) {
      cout << cipher(s[i], -keys[i % n]);
    }
    cout << endl;
  }
}

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

char Decryption(int k, char s) {
  char station[] = {'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 num;

  for(int i = 0; i < 52; i++) {
    if(s >= 'a' && s <= 'z')
      num = s - 'a';
    else
      num = s - 39;
  }
  return station[(52 + num - k) % 52];
}

int main() {
  vector<int> K;
  int n;
  string s_in;
  string s_out;

  while(1) {
    cin >> n;
    if(n == 0)
      break;

    for(int i = 0; i < n; i++) {
      int k;
      cin >> k;
      K.push_back(k);
    }

    cin >> s_in;

    for(int i = 0; i < s_in.size(); i++) {
      s_out += Decryption(K[i%n], s_in[i]);
    }

    cout << s_out << endl;

    s_out.erase();
    K.clear();
  }
  return 0;
}