// Arup Guha
// 9/25/2018
// Utility Program to do Mutual Index of Coincidence Analysis of a Vigenere Ciphertext with known keyword length.
// Specifically edited for Question 4 of Homework 2 (Fall 2018)

import java.util.*;

public class micanalysisq4 {
	
	// Put keyword length here.
	final public static int N = 11;
	
	public static void main(String[] args) {
		
		Scanner stdin = new Scanner(System.in);
		String cipher = stdin.next();
		
		// Creates all frequency bins.
		int[][] freq = new int[N][26];
		int[] tot = new int[N];
		for (int i=0; i<cipher.length(); i++) {
			freq[i%N][cipher.charAt(i)-'a']++;
			tot[i%N]++;
		}
		
		// Will only store best relative shifts here.
		int[] relshift = new int[N-1];
		
		// Loop through rest of the bins after bin 0 (first bin).
		for (int bin=1; bin<N; bin++) {
			
			// Will store all MICs paired with corresponding shifts here.
			pair[] choices = new pair[26];
			
			// Shift will represent how much more forward bin #bin is than bin 0.
			for (int shift=0; shift<26; shift++) {
				
				// Calculate MIC here.
				double cur = 0;
				for (int i=0; i<26; i++)
					cur += (1.0*freq[0][i]/tot[0])*(1.0*freq[bin][(i+shift+26)%26]/tot[bin]);
					
				// Store this shift with its MIC.
				choices[shift] = new pair(shift, cur);
			}
			
			// Sort by MIC biggest to least.
			Arrays.sort(choices);
			relshift[bin-1] = choices[0].shift;
			
			// Print out two best.
			System.out.println( (bin+1) + ": "+ choices[0].shift +" and "+ choices[1].shift);
		}
		
		// Print out 26 possibilities based on only the max answers.
		for (int i=0; i<26; i++) {
			System.out.print((char)('a'+i));
			for (int j=0; j<N-1; j++)
				System.out.print( (char)((relshift[j]+i)%26+'a') );
			System.out.println();
		}
		
		// I hard-coded this after viewing the print out above, which indicates a possible keyword of travytaexvq
		int[] key = new int[N];
		key[0] = 19;
		for (int i=1; i<N; i++) 
			key[i] = (key[0]+relshift[i-1])%26;
			
		// Based on viewing the somewhat decrypted ciphertext, these were the changes made to the keyword: travmtwelve.
		key[4] = 12;
		key[6] = 22;
		key[8] = 11;
		key[10] = 4;

		// Now, this will print out the correct plaintext for #3.
		for (int i=0; i<cipher.length(); i++) {
			char c = (char)(((cipher.charAt(i) - 'a') - key[i%N] + 26)%26 +'a');
			System.out.print(c);
		}
		System.out.println();
		
	}
}

// Stores pairs by max mic to min mic.
class pair implements Comparable<pair> {
	
	public int shift;
	public double mic;
	
	public pair(int idx, double prob) {
		shift = idx;
		mic = prob;
	}
	
	public int compareTo(pair other) {
		if (this.mic > other.mic-1e-9) return -1;
		if (this.mic < other.mic+1e-9) return 1;
		return 0;
	}
}