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<string>
#include<cctype>
#include<algorithm>

using namespace std;

char encode(char a,int k){
  a-=k;
  if('Z'<a && a<'a')a-=26+'a'-'A';
  else if(a<'A')a+=26+'a'-'A';
  while(!isalpha(a))a+=26;
  return a;
}

int main(void){

  int n;

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

    for(int i=0;i<s.size();i++){
      s[i]=encode(s[i],k[i%k.size()]);
    }
    cout << s << endl;
  }
  return 0;
}

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

using namespace std;

const string str1(
    {"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTU"
     "VWXYZ"});
const string str2(
    {"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstu"
     "vwxyz"});

int32_t main() {
  while (true) {
    uint32_t n = 0;
    cin >> n;
    if (n == 0) break;
    vector<uint32_t> keys;
    for (uint32_t i = 0; i < n; i++) {
      uint32_t key;
      cin >> key;
      keys.push_back(key);
    }

    string list;
    cin >> list;
    uint32_t key_index = 0;
    for (uint32_t i = 0; i < list.size(); i++) {
      char val;
      if ('A' <= list[i] && list[i] <= 'Z') {
        val = str1[str1.find(list[i], 26) - keys[key_index]];
      } else {
        val = str2[str2.find(list[i], 26) - keys[key_index]];
      }
      cout << val;
      key_index++;
      key_index %= keys.size();
    }
    cout << endl;
  }

  return 0;
}

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

char solve(char c, int k) {
    for (int i = 0; i < k; i++) {
        if (c == 'a') c = 'Z';
        else if (c == 'A') c = 'z';
        else c--;
    }
    return c;
}

int main() {
    int n;
    while (cin >> n, n) {
        vector<int> k(n);
        for (int& x : k) cin >> x;
        string s;
        cin >> s;
        for (int i = 0; i < s.size(); ++i) {
            cout << solve(s[i], k[i % n]);
        }
        cout << endl;
    }
    return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;
int main(){
  int n;
  cin >> n;
  while(n!=0){
    int k[101]={},i,j;
    for(i=0;i<n;i++) cin >> k[i];
    string str;
    cin >> str;
    for(i=0;i<str.size();i++){
      for(j=0;j<k[i%n];j++){
	str[i]--;
      if(str[i]<'A') str[i]+=58;
      else if(str[i]>'Z'&&str[i]<'a') str[i]-=6;
      }
      cout << str[i];
    }
    cout << endl;
    cin>>n;
  }
  return 0;
}

C++: // AOJ 2508
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<string>
#include<cctype>
#define rep(i,a) for( int i = 0; i != (a); ++i )

int n;
int k[100];
std::string s;

char step( int i )
{
	bool fl = isupper(s[i]);
	int t = s[i]-(fl?'A':'a')-k[i%n];

	while( t < 0 )
		t += 26, fl ^= true;

	return t+(fl?'A':'a');
}

int main()
{
	while( std::cin >> n, n )
	{
		rep( i, n )
			std::cin >> k[i];
		std::cin >> s;

		rep( i, s.size() )
			std::cout << step(i);

		std::cout << std::endl;
	}

	return 0;
}

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

class Solve {
private:
public:
    bool is_last_;
    Solve()
    {
        int n;
        std::cin >> n;
        if (n == 0)
        {
            is_last_ = true;
            return;
        }
        std::vector<int> k(n);
        for (auto& e: k) std::cin >> e;
        std::string s;
        std::cin >> s;
        for (int i{}; i < (int)s.size(); i++)
        {
            int p{(52 - k[i % n])};
            if ('a' <= s[i] && s[i] <= 'z')
                p += s[i] - 'a';
            else
                p += s[i] - 'A' + 26;
            p %= 52;
            if (p < 26) putchar('a' + p);
            else putchar('A' + p - 26);
        }
        putchar('\n');
    }
};

int main()
{
    while (!Solve().is_last_);
}

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

using namespace std;

const int MAX_N = 100;

int key[MAX_N];

int main ( void )
{
	int n;
	while (cin >> n, n) {
		for (int i = 0; i < n; ++i) {
			cin >> key[i];
		}
		string s, out;
		cin >> s;
		for (int i = 0, I = s.size(); i < I; ++i) {
			char c = s[i];
			for (int j = 0, J = key[i%n]; j < J; ++j) {
				--c;
				if (c < 'A') {
					c = 'z';
				}
				else if ('Z' < c && c < 'a') {
					c = 'Z';
				}
			}
			out += c;
		}
		cout << out << endl;
	}
	return 0;
}

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

using namespace std;

string narabi = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
int convert(char c) {
	if (c >= 'a' && c <= 'z')return c - 'a';
	else return c - 'A' + 26;
}

int main() {
	int N;
	while (cin >> N, N != 0) {
		vector<int> rolling;
		for (int i = 0; i < N; i++) {
			int a;
			cin >> a;
			rolling.push_back(a);
		}

		string ans = "";
		string input;
		cin >> input;
		for (int i = 0; i < input.size(); i++) {
			ans += narabi[(convert(input[i]) - rolling[i % rolling.size()] + 52) % 52];
		}
		cout << ans << endl;
	}
	return 0;
}