// Arup Guha
// 7/12/06
// A very quick program that prints out the substitution alphabet for an
// affine cipher given the encryption keys a and b in the formula
// f(x) = (ax+b)%26.

import java.util.*;

public class affine {

  public static void main(String[] args) {
 
    Scanner stdin = new Scanner(System.in);
    System.out.println("Enter the a and b for encryption in the affine cipher.");

    // Get the key.
    int a = stdin.nextInt();
    int b = stdin.nextInt();

    System.out.println("Here's the alphabet, plaintext on the first row.");

    // Print out the plain text letters in order.
    for (int i=0; i<26; i++) 
      System.out.print((char)('A'+i)+"  ");
    System.out.println("\n");

    // Print out the corresponding cipher text letters.    
    for (int i=0; i<26; i++) 
      System.out.print((char)('A'+((a*i+b)%26))+"  ");
    System.out.println();


  }

}
