#include #include #include using namespace std; char grid[5][5]; struct rc { int r,c; } loc[26]; void fillGrid(string s) { bool used[26] = {0}; int k=0; for(int i=0; i> ncase; getline(cin, key); for(int icase=1; icase<=ncase; icase++) { getline(cin, key); fillGrid(key); getline(cin, tmp); plain = ""; for(int i=0; i plain.length()) encrypt(plain[i], nextInsert(plain[i], insert), e1, e2); else if (plain[i] == plain[i+1]) { encrypt(plain[i], nextInsert(plain[i], insert), e1, e2); i--; } else encrypt(plain[i], plain[i+1], e1, e2); cout << e1 << e2; } cout << endl; } }