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 <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>
#include <math.h>
#include <utility>
#include <set>
#include <map>
#include <cstring>
#include <cstdio>
#include <stack>
#define INF 1000000000
#define rep(i,n) for(int i =0;i<n;i++)
using namespace std;
typedef long long int ll;

char o(int n, char a){
    if(n==0) return a;
    if(a=='a') return o(n-1,'Z');
    if(a=='b') return o(n-1,'a');
    if(a=='c') return o(n-1,'b');
    if(a=='d') return o(n-1,'c');
    if(a=='e') return o(n-1,'d');
    if(a=='f') return o(n-1,'e');
    if(a=='g') return o(n-1,'f');
    if(a=='h') return o(n-1,'g');
    if(a=='i') return o(n-1,'h');
    if(a=='j') return o(n-1,'i');
    if(a=='k') return o(n-1,'j');
    if(a=='l') return o(n-1,'k');
    if(a=='m') return o(n-1,'l');
    if(a=='n') return o(n-1,'m');
    if(a=='o') return o(n-1,'n');
    if(a=='p') return o(n-1,'o');
    if(a=='q') return o(n-1,'p');
    if(a=='r') return o(n-1,'q');
    if(a=='s') return o(n-1,'r');
    if(a=='t') return o(n-1,'s');
    if(a=='u') return o(n-1,'t');
    if(a=='v') return o(n-1,'u');
    if(a=='w') return o(n-1,'v');
    if(a=='x') return o(n-1,'w');
    if(a=='y') return o(n-1,'x');
    if(a=='z') return o(n-1,'y');
    if(a=='A') return o(n-1,'z');
    if(a=='B') return o(n-1,'A');
    if(a=='C') return o(n-1,'B');
    if(a=='D') return o(n-1,'C');
    if(a=='E') return o(n-1,'D');
    if(a=='F') return o(n-1,'E');
    if(a=='G') return o(n-1,'F');
    if(a=='H') return o(n-1,'G');
    if(a=='I') return o(n-1,'H');
    if(a=='J') return o(n-1,'I');
    if(a=='K') return o(n-1,'J');
    if(a=='L') return o(n-1,'K');
    if(a=='M') return o(n-1,'L');
    if(a=='N') return o(n-1,'M');
    if(a=='O') return o(n-1,'N');
    if(a=='P') return o(n-1,'O');
    if(a=='Q') return o(n-1,'P');
    if(a=='R') return o(n-1,'Q');
    if(a=='S') return o(n-1,'R');
    if(a=='T') return o(n-1,'S');
    if(a=='U') return o(n-1,'T');
    if(a=='V') return o(n-1,'U');
    if(a=='W') return o(n-1,'V');
    if(a=='X') return o(n-1,'W');
    if(a=='Y') return o(n-1,'X');
    if(a=='Z') return o(n-1,'Y');
    return 's';
}

int main(){
    for(;;){
        int n;
        cin >>n;
        if(!n)break;
        vector<int> key(n);
        rep(i,n) cin >> key[i];
        string s;
        cin >> s;
        string ans="";
        int j=0;
        for (int i=0; i<s.length(); i++) {
            ans += o(key[j],s[i]);
            j++;
            if(j==key.size()) j=0;
        }
        cout << ans << endl;
    }
}

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;
    int keyid = 0;
    for (int i = 0; i < s.size(); i++) {
      char c = s[i];
      int cnt = k[keyid];
      while (0 < cnt) {
        if (c == 'a')
          c = 'Z';
        else if (c == 'A')
          c = 'z';
        else
          c--;
        cnt--;
      }
      s[i] = c;
      keyid = (keyid + 1) % n;
    }
    cout << s << endl;
  }

  return 0;
}

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

int main(){
    
    string str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
    str = str + str + str;
    /*for(int i = 0; str[i] != '\0'; i++){
        cout << i << ":" << str[i] << endl;
    }*/
    while(1){
        int n; cin >> n;
        if(!n) break;
        vector<int> key(n);
        for(int i = 0; i < n; i++){
            cin >> key[i];
        }

        string s; cin >> s;
        int j = 0;
        int idx;
        for(int i = 0; i < s.size(); i++){
            for(int k = 52; k <= 103; k++){
                if(s[i] == str[k]) idx = k;
            }
            //cout << idx << " " << key[j];
            idx -= key[j];
            s[i] = str[idx];
            j++;
            if(j == n) j = 0;
        }

        cout << s << endl;
    }

    return 0;
}

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

using namespace std;

int main(){
    while(true){
        int n;
        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="";
        int kc=0;
        for(auto c:s){
            if(kc>=n)kc=0;
            int lc=c-'a';
            int uc=c-'A';
            int tkc=k[kc];
            if(0<=lc&&lc<=25){//小文字
                if(tkc<=lc)ans+=(char)('a'+lc-tkc);
                else {
                    lc+=26;
                    if(tkc<=lc){
                        ans+=(char)('A'+lc-tkc);
                    }
                    else{
                        lc+=26;
                        ans+=(char)('a'+lc-tkc);
                    }
                }
            }
            else{//大文字
                if(tkc<=uc)ans+=(char)('A'+uc-tkc);
                else {
                    uc+=26;
                    if(tkc<=uc){
                        ans+=(char)('a'+uc-tkc);
                    }
                    else{
                        uc+=26;
                        ans+=(char)('A'+uc-tkc);
                    }
                }
            }
            ++kc;
        }
        for(auto i:ans)cout<<i;
        cout<<endl;
    }
    return 0;
}