#include #include int main() { std::string A = ".........\n" ".........\n" ".........\n" ".........\n" "....*....\n" "...##....\n" "..#.#....\n" ".#..#....\n" "........."; std::string B = ".........\n" ".........\n" ".........\n" ".........\n" ".###*....\n" "....#....\n" "....#....\n" "....#....\n" "........."; std::string C = ".........\n" ".#.......\n" "..#......\n" "...#.....\n" "....*....\n" "....#....\n" "....#....\n" "....#....\n" "........."; std::string D = ".........\n" "....#....\n" "....#....\n" "....#....\n" "....*....\n" "....#....\n" "....#....\n" "....#....\n" "........."; std::string E = ".........\n" ".......#.\n" "......#..\n" ".....#...\n" "....*....\n" "....#....\n" "....#....\n" "....#....\n" "........."; std::string F = ".........\n" ".........\n" ".........\n" ".........\n" "....*###.\n" "....#....\n" "....#....\n" "....#....\n" "........."; std::string G = ".........\n" ".........\n" ".........\n" ".........\n" "....*....\n" "....##...\n" "....#.#..\n" "....#..#.\n" "........."; std::string H = ".........\n" ".........\n" ".........\n" ".........\n" ".###*....\n" "...#.....\n" "..#......\n" ".#.......\n" "........."; std::string I = ".........\n" ".#.......\n" "..#......\n" "...#.....\n" "....*....\n" "...#.....\n" "..#......\n" ".#.......\n" "........."; std::string K = ".........\n" "....#....\n" "....#....\n" "....#....\n" "....*....\n" "...#.....\n" "..#......\n" ".#.......\n" "........."; std::string J = ".........\n" "....#....\n" "....#....\n" "....#....\n" "....*###.\n" ".........\n" ".........\n" ".........\n" "........."; std::string L = ".........\n" ".......#.\n" "......#..\n" ".....#...\n" "....*....\n" "...#.....\n" "..#......\n" ".#.......\n" "........."; std::string M = ".........\n" ".........\n" ".........\n" ".........\n" "....*###.\n" "...#.....\n" "..#......\n" ".#.......\n" "........."; std::string N = ".........\n" ".........\n" ".........\n" ".........\n" "....*....\n" "...#.#...\n" "..#...#..\n" ".#.....#.\n" "........."; std::string O = ".........\n" ".#.......\n" "..#......\n" "...#.....\n" ".###*....\n" ".........\n" ".........\n" ".........\n" "........."; std::string P = ".........\n" "....#....\n" "....#....\n" "....#....\n" ".###*....\n" ".........\n" ".........\n" ".........\n" "........."; std::string Q = ".........\n" ".......#.\n" "......#..\n" ".....#...\n" ".###*....\n" ".........\n" ".........\n" ".........\n" "........."; std::string R = ".........\n" ".........\n" ".........\n" ".........\n" ".###*###.\n" ".........\n" ".........\n" ".........\n" "........."; std::string S = ".........\n" ".........\n" ".........\n" ".........\n" ".###*....\n" ".....#...\n" "......#..\n" ".......#.\n" "........."; std::string T = ".........\n" ".#..#....\n" "..#.#....\n" "...##....\n" "....*....\n" ".........\n" ".........\n" ".........\n" "........."; std::string U = ".........\n" ".#.....#.\n" "..#...#..\n" "...#.#...\n" "....*....\n" ".........\n" ".........\n" ".........\n" "........."; std::string V = ".........\n" "....#....\n" "....#....\n" "....#....\n" "....*....\n" ".....#...\n" "......#..\n" ".......#.\n" "........."; std::string W = ".........\n" ".......#.\n" "......#..\n" ".....#...\n" "....*###.\n" ".........\n" ".........\n" ".........\n" "........."; std::string X = ".........\n" ".......#.\n" "......#..\n" ".....#...\n" "....*....\n" ".....#...\n" "......#..\n" ".......#.\n" "........."; std::string Y = ".........\n" ".#.......\n" "..#......\n" "...#.....\n" "....*###.\n" ".........\n" ".........\n" ".........\n" "........."; std::string Z = ".........\n" ".........\n" ".........\n" ".........\n" "....*###.\n" ".....#...\n" "......#..\n" ".......#.\n" "........."; std::vector alpha = {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}; int num, caesar; std::cin >> num >> caesar; std::string currLetter; std::cin >> currLetter; for (int i = 0; i < num; ++i) { for(int j = 0; j < 9; ++j) { std::string tmp; getline(std::cin, tmp); currLetter += tmp; if(j != 8){ currLetter += '\n'; } } for(int j = 0; j < alpha.size(); ++j) { if (alpha[j] == currLetter) { std::cout << alpha[((j + caesar) % 26)] << ((i == num) ? "" : "\n") << std::flush; break; } } currLetter.clear(); } return 0; }