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){
    vector<int> k(n);

    for(int i=0;i<n;++i)
      cin>>k[i];

    string s;cin>>s; 
    vector<char> c;

    for(int i=0;i<s.size();++i){
      c.emplace_back(s.at(i));
      int key = k[i%k.size()];
      while(key!=0){
        int tmp;
        if(key>26){
          key -= 26;
          tmp = 26;
        }else{
          tmp = key;
          key -= key;
        }

        if(c[i]>='A'&&c[i]<='Z'){
          c[i] -= tmp;
          if(c[i]<'A'){
            char sub = 'A' - c[i] - 1;
            c[i] = 'z' - sub;
          }
        }
        else if(c[i]>='a'&&c[i]<='z'){
          c[i] -= tmp;
          if(c[i]<'a'){
            char sub = 'a' - c[i] - 1;
            c[i] = 'Z' - sub;
          }
        }
      }
      cout<<c[i];
    }
    cout<<endl;
  }

  return EXIT_SUCCESS;
}

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

int main(){
  while(1){
    int n;
    cin>>n;
    int a;
    if(n==0)break;
    vector<int> k(n);
    string s;
    for(int i=0;i<n;i++)cin>>k[i];
    cin>>s;
    for(int i=0;i<s.size();i++){
      if(k[i%n]<=26){
        a=s[i]-k[i%n];
        if(a<'A'&&s[i]>='A'&&s[i]<='Z'){
           a+='z'-'A';
         }else if(a<'a'&&s[i]>='a'&&s[i]<='z')a-='a'-'Z';
      }else{
        a=s[i]+(52-k[i%n]);
        if(a>'z'&&s[i]>='z'&&s[i]>='a'){
          a-='z'-'A';
        }else if(a>'Z'&&s[i]<='Z'&&s[i]>='A')a+='a'-'Z';
      }
      putchar(a);
    }
    cout<<endl;
  }
  return 0;
}

C++: // King's Inspection

#include <iostream>
#include <cstring>
#include <vector>
#include <cstdio>

using namespace std;

int main() {
    int n;
    int now=0;
    int k[102];
    string station;
    string ans;
    string alpha = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
    
    while(1) {
      // Input
        cin>>n;
        if(n == 0) {
            break;
        }
        for(int i=0; i<n; i++) {
            cin>>k[i];
        }
        cin.ignore();

	// Output
	now = 0;
	getline(cin, station);

	for(int i=0; i<station.length(); i++) {
	    int tmp;
	    tmp = alpha.find(station[i]);
	    ans[i] = alpha[(tmp-k[now]+52)%52];
	    now++;
            if(now == n) {
                now = 0;
            }
	}
        for(int i=0; i<station.length(); i++) {
            cout<<ans[i];
        }
        cout<<endl;
    }
}

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

const int N = 100;

int main(){
	int n, k[N];
	string s;
	while(cin >> n, n){
		for(int i = 0;i < n;++i){
			cin >> k[i];
		}
		cin >> s;
		for(int i = 0;i < s.length();++i){
			int idx = i % n, chr;
			chr = s[i] - k[idx];
			if(islower(s[i])){
				chr -= 'a';
				if(chr < 0) chr = 'Z' + chr + 1;
				else chr += 'a';
			}
			else{
				chr -= 'A';
				if(chr < 0) chr = 'z' + chr + 1;
				else chr += 'A';
			}
			cout << (char)(chr);
		}
		cout << endl;
	}
}

C++: #include <bits/stdc++.h>
using namespace std;
char s[101];
int main() {
    int n;
    while(scanf("%d",&n),n) {
        vector<int> key;
        for(int i=0;i<n;i++) {
            int k;
            scanf("%d",&k);
            key.push_back(k);
        }
       scanf("%s",s);
       for(int i=0;s[i]!='\0';i++) {
            int code=0;
            if('a'<=s[i]&&s[i]<='z') code=s[i]-'a';
            if('A'<=s[i]&&s[i]<='Z') code=26+s[i]-'A';
            code-=key[i%key.size()];
            while(code<0) code+=52;
            code%=52;
            if(0<=code&&code<=25) putchar('a'+code);
            if(26<=code&&code<=51) putchar('A'+code-26);
       }
       putchar('\n');
    }
}

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

string Alpha = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
int l = 52;

int main(void) {
    int n, x, d;
    int k[1000];
    string s;
    map<char, int> mp;
    for (int i = 0; i < 52; i++) mp[Alpha[i]] = i;

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

        for (int i = 0; i < n; i++) cin >> k[i];
        cin >> s;

        for (int i = 0; i < s.size(); i++) {
            d = k[i % n];
            x = (mp[s[i]] + 52 - d) % l;
            cout << Alpha[x];
        }
        cout << endl;
    }

    return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
 
#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false

typedef long long ll;
typedef pair<int, int> ii;


string t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";

int main() {
	
	int n;
	while(cin >> n, n){
		vector<int> k(n);
		rep(i, n) cin >> k[i];
		string s;
		cin >> s;
		
		rep(i, s.size()){
			int d = (s[i] <= 'Z' ? s[i] - 'A' : 26 + s[i] - 'a');
			cout << t[(d+52-k[(i%n)])%52];
		}
		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++){
      str[i]-=k[i%n];
      if(str[i]<'A') str[i]+=58;
      else if(str[i]>'Z'&&str[i]<'a') str[i] -= 6;
    }
    cout << str << endl;
    cin>>n;
  }
  return 0;
}