/* * To change this template, choose Tools | Templates * and open the template in the editor. */ import java.util.Scanner; /** * * @author louma */ public class encipher { public static void main(String[] args) { Scanner a = new Scanner(System.in); while (true) { String line = a.nextLine(); if (line.equals("0") == true) break; short posun = Short.parseShort(line); String text = a.nextLine().replace(" ", "").toUpperCase(); if (posun >= text.length()) { System.out.println(text); continue; } char[] vystup = text.toCharArray(); for (int i = 0, j = 0; j < text.length(); i = (i + posun) % vystup.length, j++) { vystup[i] = text.charAt(j); } System.out.println(new String(vystup)); } } }