// Thomas Lukas
// 8/25/2020
// Code for CIS 3362 Homework #1 Problem #3

#include <stdio.h>
#include <string.h>

int main(void)
{
 int a,b,x,y, length;
 int coprimes[] = {1,3,5,7,9,11,15,17,19,21,23,25};
 char text[500];

 scanf("%s", text);
 length = strlen(text);

 // All possible values of a for decryption.
 for (x=0; x<12; x++)
 {
    // All possible values of b for decryption.
    for (b=0; b<26; b++)
    {
        printf("%d %d  :", coprimes[x], b);

        // Apply ax+b to each letter.
        for (y=0; y<length; y++)
        {
          printf("%c", (coprimes[x]*(text[y]-'a')+b) %26 + 'a');
        }

        printf("\n");
    }
 }
 return 0;
}
