#include using namespace std; const int MAXSIZE = 10; const int BIG = 37*37; int m[MAXSIZE][MAXSIZE]; char alphabet[] = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ' '}; int inverse[37] = {0, 1, 19, 25, 28, 15, 31, 16, 14, 33, 26, 27, 34, 20, 8, 5, 7, 24, 35, 2, 13, 30, 32, 29, 17, 3, 10, 11, 4, 23, 21, 6, 22, 9, 12, 18, 36}; int* convert(string s) { int *ans = new int[s.length()]; for(int i=0; i0; r--) { for(int i=r-1; i>=0; i--) { int factor = a[i][r]; for(int j=0; j> n; getline(cin, plain); getline(cin, plain); while (plain.length()%n != 0) plain += ' '; getline(cin, cipher); if (!process(plain, cipher, n)) { cout << "No solution" << endl; exit(0); } // cout << plain << ',' << cipher << endl; int len = cipher.length(); if (len < n*n) { cout << "Too many solutions" << endl; exit(0); } string rows[n], cols[n]; int mat[MAXSIZE][MAXSIZE], save[MAXSIZE][MAXSIZE]; bool solFound = false; // solve each set, checking if // results are the same bool ok = true; for(int start=0; start < len; start+=n*n) { //cout << start << endl; if (len-start < n*n) start = len-n*n; for(int i=0; i