#include #include char caesar(char x,int shift){ shift = shift%26; int newChar = x; newChar += shift; if ( newChar > 122 ){ newChar = newChar - 122 + 96; } return newChar; } int main(){ //std::cout << caesar('z',27); /*int down = 5*9+5+6*9+5+7*9+5; int leftDown = 5*9+4+6*9+3+7*9+2; int left = 4*9+2+4*9+3+4*9+4; int leftTop = 1*9 + 2 + 2*9 + 3 + 3*9+4; int top = 1*9+5+2*9+5+3*9+5; int topRight = 1*9+8+2*9+7+3*9+6; int right = 4*9+6+4*9+7+4*9+8; int downRight = 5*9+6+6*9+7+7*9+8; std::map conversion = {{'a',down + leftDown},{'b',left+down},{'c',leftTop+down},{'d',down + top},{'e',down + topRight}, {'f',down + right},{'g',down+downRight},{'h',left + leftDown},{'i',leftTop + leftDown},{'j',top + right}, {'k',leftDown + top},{'l',leftDown +topRight},{'m',right+ leftDown},{'n',downRight + leftDown},{'o',leftTop + left}, {'p',left + top},{'q',left +topRight},{'r',right+ left},{'s',downRight + left},{'t',leftTop + top}, {'u',leftTop + topRight},{'v',top + downRight},{'w',right+ topRight},{'x',downRight + topRight},{'y',leftTop + right},{'z',right+downRight}}; */ std::map conversionString = {{'a',".........\n" ".........\n" ".........\n" ".........\n" "....*....\n" "...##....\n" "..#.#....\n" ".#..#....\n" ".........\n"}, {'b',".........\n" ".........\n" ".........\n" ".........\n" ".###*....\n" "....#....\n" "....#....\n" "....#....\n" ".........\n"}, {'c',".........\n" ".#.......\n" "..#......\n" "...#.....\n" "....*....\n" "....#....\n" "....#....\n" "....#....\n" ".........\n"}, {'d',".........\n" "....#....\n" "....#....\n" "....#....\n" "....*....\n" "....#....\n" "....#....\n" "....#....\n" ".........\n"}, {'e',".........\n" ".......#.\n" "......#..\n" ".....#...\n" "....*....\n" "....#....\n" "....#....\n" "....#....\n" ".........\n"}, {'f',".........\n" ".........\n" ".........\n" ".........\n" "....*###.\n" "....#....\n" "....#....\n" "....#....\n" ".........\n"}, {'g', ".........\n" ".........\n" ".........\n" ".........\n" "....*....\n" "....##...\n" "....#.#..\n" "....#..#.\n" ".........\n"}, {'h', ".........\n" ".........\n" ".........\n" ".........\n" ".###*....\n" "....#....\n" "....#....\n" "....#....\n" ".........\n"}, {'i', ".........\n" ".#.......\n" "..#......\n" "...#.....\n" "....*....\n" "...#.....\n" "..#......\n" ".#.......\n" ".........\n"}, {'j',".........\n" "....#....\n" "....#....\n" "....#....\n" "....*###.\n" ".........\n" ".........\n" ".........\n" ".........\n"}, {'k',".........\n" "....#....\n" "....#....\n" "....#....\n" "....*....\n" "...#.....\n" "..#......\n" ".#.......\n" ".........\n"}, {'l',".........\n" ".......#.\n" "......#..\n" ".....#...\n" "....*....\n" "...#.....\n" "..#......\n" ".#.......\n" ".........\n"}, {'m',".........\n" ".........\n" ".........\n" ".........\n" "....*###.\n" "...#.....\n" "..#......\n" ".#.......\n" ".........\n"}, {'n',".........\n" ".........\n" ".........\n" ".........\n" "....*....\n" "...#.#...\n" "..#...#..\n" ".#.....#.\n" ".........\n"}, {'o', ".........\n" ".#.......\n" "..#......\n" "...#.....\n" ".###*....\n" ".........\n" ".........\n" ".........\n" ".........\n"}, {'p',".........\n" "....#....\n" "....#....\n" "....#....\n" ".###*....\n" ".........\n" ".........\n" ".........\n" ".........\n"}, {'q',".........\n" ".......#.\n" "......#..\n" ".....#...\n" ".###*....\n" ".........\n" ".........\n" ".........\n" ".........\n"}, {'r',".........\n" ".........\n" ".........\n" ".........\n" ".###*###.\n" ".........\n" ".........\n" ".........\n" ".........\n"}, {'s',".........\n" ".........\n" ".........\n" ".........\n" ".###*....\n" ".....#...\n" "......#..\n" ".......#.\n" ".........\n"}, {'t',".........\n" ".#..#....\n" "..#.#....\n" "...##....\n" "....*....\n" ".........\n" ".........\n" ".........\n" ".........\n"}, {'u',".........\n" ".#.....#.\n" "..#...#..\n" "...#.#...\n" "....*....\n" ".........\n" ".........\n" ".........\n" ".........\n"}, {'v',".........\n" "....#....\n" "....#....\n" "....#....\n" "....*....\n" ".....#...\n" "......#..\n" ".......#.\n" ".........\n"}, {'w',".........\n" ".......#.\n" "......#..\n" ".....#...\n" "....*###.\n" ".........\n" ".........\n" ".........\n" ".........\n"}, {'x',".........\n" ".......#.\n" "......#..\n" ".....#...\n" "....*....\n" ".....#...\n" "......#..\n" ".......#.\n" ".........\n"}, {'y',".........\n" ".#.......\n" "..#......\n" "...#.....\n" "....*###.\n" ".........\n" ".........\n" ".........\n" ".........\n"}, {'z',".........\n" ".........\n" ".........\n" ".........\n" "....*###.\n" ".....#...\n" "......#..\n" ".......#.\n" ".........\n"}}; int length; int caesarShift; std::cin >> length >> caesarShift; char tmp; std::string res = ""; std::string g = ""; for (int i = 0; i < length;i++){ for (int j = 0;j< 9;j++){ for ( int k = 1;k< 10;k++){ std::cin >> tmp; g += tmp; } g += '\n'; } for ( auto element : conversionString){ if (element.second == g){ char newChar = caesar(element.first,caesarShift); res += conversionString.at(newChar); } } } std::cout << res; return 0; }