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

char table[53]="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
inline int access(int num,int div){ return (num+div)%div;}

int main(){
  int n;
  while(cin>>n,n){
    vector<int> key(n);
    for(int i=0;i<n;i++)
      cin>>key[i];
    string str;
    cin>>str;
    int data=0;
    for(int i=0;i<(int)str.size();i++){
      if('a'<= str[i] && str[i] <= 'z') data=int(str[i]-'a');
      else if('A' <= str[i] && str[i] <= 'Z') data=int(str[i]-'A'+26);
      str[i]=table[access(data-key[access(i,n)],52)];
    }
    cout<<str<<endl;
  }
  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

int n;
int ks[114514];
char buf[114514];
char ans[114514];
vector<char> cs;
map<char, int> rev;

int main() {
  for (int i=0; i<26; i++) cs.push_back('a'+i);
  for (int i=0; i<26; i++) cs.push_back('A'+i);
  for (int i=0; i<52; i++) {
    rev[cs[i]] = i;
  }

  while (1) {
    scanf("%d", &n);
    if (n == 0) return 0;

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

    int k = strlen(buf);
    for (int i=0; i<k; i++) {
      int idx = rev[buf[i]];
      ans[i] = cs[(52+idx-ks[i%n])%52];
    }
    ans[k] = '\0';
    puts(ans);
  }
}

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

using namespace std; 

string list = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";

int main()
{
	int n, l, p;
	string s, ans;

	while(cin >> n){
		if(n==0){return 0;}
		ans = "";
		int* key = new int[n];
		for(int i=0; i<n; i++){ cin >> key[i];}
		cin >> s;
		l = s.length();
		for(int i=0; i<l; i++){ 
			p = list.find(s.substr(i,1)) - key[i%n];
			if(p<1){ p+=104; p=p%52;}
			ans += list.substr(p,1);
		}
		cout << ans << endl;
	}	
}

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

using namespace std;

const int MAX_N = 100005;

int n;

int main()
{
    while(1){
        cin >> n;
        if(n == 0){
            break;
        }
        vector<int> vec(n);
        for(int i=0;i<n;i++){
            cin >> vec[i];
        }
        string s;
        cin >> s;
        for(int i= 0;i < s.length();i++){
            int k = s[i] - 'a';
            if((int)(s[i] - 'a') >= 0){
                if((int)(s[i] - 'a') >= vec[i%n]){
                    cout << (char)(s[i] - vec[i%n]);
                }else{
                    cout << (char)('Z' - (vec[i%n] - k-1));
                }
            }else{
                if((int)(s[i] - 'A') >= vec[i%n]){
                    cout << (char)(s[i] - vec[i%n]);
                }else{
                    k = (int)(s[i] - 'A');
                    cout << (char)('z' - (vec[i%n] - k-1));
                }
            }
        }
        cout << "\n";
    }
}

C++: #include <stdio.h>

//FILE * in = freopen("input.txt", "r", stdin);

int n;
int key[100];
char temp[1000];

char getChar(char c, int key){
	int code = 0;
	if('A' <= c && c <= 'Z') {
		code = c - 'A';
	}
	else if('a' <= c && c <= 'z'){
		code = c - 'a' + 26;
	}

	code -= key;
	if(code < 0) code += 52;

	if(code < 26) {
		return code + 'A';
	}
	return code + 'a' - 26;
}

void process(){
	int kp = 0;
	for(int i = 0; temp[i] ; i++){
		temp[i] = getChar(temp[i], key[kp++]);
		kp %= n;
	}
}

int main() {
	while(true){
		scanf("%d", &n);
		if(n == 0) break;
		for(int i = 0; i < n; i++) {
			scanf("%d", &key[i]);
		}
		gets(temp);
		gets(temp);
		process();
		printf("%s\n", temp);
	}
	return 0;
}

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

using namespace std;

int main()
{
    int n;
    
    while (scanf("%d", &n) && n){
        int a[128];
        char s[128];
        
        for (int i = 0; i < n; i++) scanf("%d", a + i);
        scanf("%s", s);
        
        for (int i = 0; s[i]; i++){
            s[i] -= a[i % n];
            if (isupper(s[i] + a[i % n])){
                printf("%c", s[i] - 'A' >= 0 ? s[i] : tolower(s[i] + 26));
            }
            else {
                printf("%c", s[i] - 'a' >= 0 ? s[i] : toupper(s[i] + 26));
            }
        }
        printf("\n");
    }
    
    return (0);
}