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

bool notrange(char a){
  return (!(('a' <= a && a <= 'z') || ('A' <= a && a <= 'Z')));
}

int main(){
  
  while(1){
  	int n;
  	cin >> n;
  	if(n == 0) break;
  	int i;
  	int k[100];
  	for (i = 0; i < n; i++) {
  	  cin >> k[i];
  	}
  	string str = "";
  	cin >> str;
  	int j;
  	string str2 = "";
  	int a = 0;
	
  	for(j = 0;j < (int) str.length();j++){
  	  a = j;
  	  while(!(a < i)){
  		a -= i;
  	  }

  	  char c = str[j] - k[a];
	  
  	  if(c < 'a' && c > 'Z' && notrange(c)){
		// cout << 'a' -c << endl;
  		c = 'Z'-('a' - c - 1);
  	  }
  	  if(c < 'A' && notrange(c)){
  		c = 'z' - ('A' - c - 1);
  	  }
	  if(c < 'a' && c > 'Z' && notrange(c)){
  		c = 'Z'-('a' - c - 1);
  	  }
	  if(c < 'A' && notrange(c)){
  		c = 'z' - ('A' - c - 1);
  	  }

  	  cout << c;
  	}
  	cout << endl;
  }

  return 0;
}

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

using namespace std;

#define STA_MAX 52

int main()
{
	//駅順
	string sta = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";	
	int n;					//鍵の数
	int keynum[100];				
	char s[100];				//暗号となる文字列
	char ans[100];				//解読された文字列
	int count=0;

	while(true)
	{
		cin>>n;		//鍵の入力

		if(n==0)	break;

		//鍵内容の入力
		for(int i=0;i<n;i++)
		{
			cin>>keynum[i];
		}

		//暗号の入力
		cin>>s;

		for(int i=0;i<strlen(s);i++)
		{
			for(int j=0;j<sta.size();j++)
			{
				if(sta[j]==s[i])
				{
					if(j-keynum[count]>=0)
					{
						ans[i]=sta[j-keynum[count]];
					}
					else
					{
						ans[i]=sta[(STA_MAX+j)-keynum[count]];
					}
				}
			}
			count++;
			if(count==n)	count=0;
		}

		for(int i=0;i<strlen(s);i++)
		{
			cout<<ans[i];
		}
		cout<<endl;

		count=0;
	}
}

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

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  auto c2i = [](char c) {
    if (islower(c)) {
      return c - 'a';
    }
    return 26 + (c - 'A');
  };
  auto i2c = [](int i) -> char {
    if (i < 26) {
      return 'a' + i;
    }
    i -= 26;
    return 'A' + i;
  };
  int n;
  while (cin >> n, n) {
    vector<int> k(n);
    for (auto&& e : k) {
      cin >> e;
    }
    string s;
    cin >> s;
    for (int i = 0; i < (int)s.size(); ++i) {
      cout << i2c((c2i(s[i]) + 52 - k[i % n]) % 52);
    }
    cout << '\n';
  }
}

C++: #include <iostream>
#include <string.h>
using namespace std;
int main(){
  int n,key[100],i,j,cal;
  string s;
  char out;
  while(1){
    cin >> n;
    if(n==0) break;
    for(i=0;i<n;i++){
      cin >> key[i];
    }
    cin >> s;
    for(i=0,j=0;s[i]!='\0';i++,j++){
      if(j==n) j=0;
      cal=s[i]-key[j];
      while(1){
	if((97<=cal&&cal<=122)||(65<=cal&&cal<=90)) break;
	else if(cal<65){
	  cal=65-cal;
	  cal=122-cal+1;
	}
	else{
	  cal=97-cal;
	  cal=90-cal+1;
	}
      }
      out=cal;
      cout << out;
    }
    cout << endl;
  }
  return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
  int n,c=0,k,i;
  string s;
  while(cin>>n,n){
    c=0;
    int a[n];
    for(i=0;i<n;i++)cin>>a[i];
    cin>>s;
  for(i=0;i<s.size();i++){
    k=a[c++%n];
    if(int(s[i])-k>90&&int(s[i])-k<97)s[i]=s[i]-k-6;    
    else if(int(s[i])-k<65)s[i]='{'-k;
    else s[i]=s[i]-k;
  }
  cout<<s<<endl;
  }
}

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

using namespace std;

int main(){
    int n;
    while(true){
        cin>>n;
        if(n==0)break;
        vector<int> k(n);
        for (int i = 0; i < n; ++i) {
            cin>>k[i];
        }
        string s;
        cin>>s;
        vector<char> ans;
        for (int i = 0; i < s.size(); ++i) {
            int key=k[i%n];
            bool lc=('a'<=s[i]&&s[i]<='z');
            if(lc){
                if(s[i]-key>='a'){
                    ans.push_back(s[i]-key);
                }
                else {
                    key-=s[i]-'a'+1;
                    if(key<=25)ans.push_back('Z'-key);
                    else {
                        key-=26;
                        ans.push_back('z'-key);
                    }
                }
            }
            else{
                if(s[i]-key>='A'){
                    ans.push_back(s[i]-key);
                }
                else {
                    key-=s[i]-'A'+1;
                    if(key<=25)ans.push_back('z'-key);
                    else {
                        key-=26;
                        ans.push_back('Z'-key);
                    }
                }
            }
        }
        for(auto i:ans)cout<<i;
        cout<<endl;
    }
    return 0;
}

C++: #include <iostream>
#include <stack>
#include <queue>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <string>
using namespace std;


int n;
int key[1000];
string str;

char x[60];

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



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

    cin >> str;

    int size = str.size();
    //  cout << size <<" ";
    for(int i = 0,j = 0; i < size; i++,j++){
      if(i % n == 0){
	j = 0;
      }      
   
      for(int k = 0; k < key[j] ; k++){
	str[i]--;
	if(str[i]  < 'a' && str[i] > 'Z') str[i] -= 6;
	if(str[i] < 'A' ) str[i] += 52 + 6;

      }
      /*

	if(str[i] - key[j] < 'A' && str[i] <= 'Z' && ){
	str[i] += 52 + 6;
	}else  if(str[i] - key[j] < 'A' && str[i] >= 'a' ){
	str[i] += 52;
	}
	if(str[i] >= 'a' && str[i] - key[j] < 'a' && str[i] - key[j] > 'Z') str[i] -= 6;
	str[i] -= key[j];
	}

      */
    }
    cout << str << endl;
    
  }
    return 0;
  
}