#include #include #include #include #include enum class Direction { TOP, BOTTOM, RIGHT, LEFT, TOP_RIGHT, TOP_LEFT, BOTTOM_RIGHT, BOTTOM_LEFT }; class Word { public: std::vector dirs; friend auto operator<=>(const Word&, const Word&) = default; Word(bool islast) { std::string yeet; std::cin >> yeet; std::cin >> yeet; std::cin >> yeet; std::cin >> yeet; if (yeet[3] == '#'){ dirs.emplace_back(Direction::TOP_LEFT); } if (yeet[4] == '#'){ dirs.emplace_back(Direction::TOP); } if (yeet[5] == '#'){ dirs.emplace_back(Direction::TOP_RIGHT); } std::cin >> yeet; if (yeet[3] == '#'){ dirs.emplace_back(Direction::LEFT); } if (yeet[5] == '#'){ dirs.emplace_back(Direction::RIGHT); } std::cin >> yeet; if (yeet[3] == '#'){ dirs.emplace_back(Direction::BOTTOM_LEFT); } if (yeet[4] == '#'){ dirs.emplace_back(Direction::BOTTOM); } if (yeet[5] == '#'){ dirs.emplace_back(Direction::BOTTOM_RIGHT); } if (std::cin){ std::cin >> yeet; } if (std::cin){ std::cin >> yeet; } if (std::cin && !islast){ std::cin >> yeet; } } Word(Direction d1, Direction d2){ dirs.emplace_back(d1); dirs.emplace_back(d2); } Word() = default; void print(){ using enum Direction; std::cout << ".........\n"; std::string line; line += '.'; line += (dirs[0] == TOP_LEFT || dirs[1] == TOP_LEFT) ? '#' : '.'; line += ".."; line += (dirs[0] == TOP || dirs[1] == TOP) ? '#' : '.'; line += ".."; line += (dirs[0] == TOP_RIGHT || dirs[1] == TOP_RIGHT) ? '#' : '.'; line += '.'; std::cout << line << "\n"; line = ""; line += ".."; line += (dirs[0] == TOP_LEFT || dirs[1] == TOP_LEFT) ? '#' : '.'; line += "."; line += (dirs[0] == TOP || dirs[1] == TOP) ? '#' : '.'; line += "."; line += (dirs[0] == TOP_RIGHT || dirs[1] == TOP_RIGHT) ? '#' : '.'; line += ".."; std::cout << line << "\n"; line = ""; line += "..."; line += (dirs[0] == TOP_LEFT || dirs[1] == TOP_LEFT) ? '#' : '.'; line += ""; line += (dirs[0] == TOP || dirs[1] == TOP) ? '#' : '.'; line += ""; line += (dirs[0] == TOP_RIGHT || dirs[1] == TOP_RIGHT) ? '#' : '.'; line += "..."; std::cout << line << "\n"; line = ""; line += '.'; line += (dirs[0] == LEFT || dirs[1] == LEFT) ? "###" : "..."; line += "*"; line += (dirs[0] == RIGHT || dirs[1] == RIGHT) ? "###" : "..."; line += '.'; std::cout << line << "\n"; line = ""; line += "..."; line += (dirs[0] == BOTTOM_LEFT || dirs[1] == BOTTOM_LEFT) ? '#' : '.'; line += ""; line += (dirs[0] == BOTTOM || dirs[1] == BOTTOM) ? '#' : '.'; line += ""; line += (dirs[0] == BOTTOM_RIGHT || dirs[1] == BOTTOM_RIGHT) ? '#' : '.'; line += "..."; std::cout << line << "\n"; line = ""; line += ".."; line += (dirs[0] == BOTTOM_LEFT || dirs[1] == BOTTOM_LEFT) ? '#' : '.'; line += "."; line += (dirs[0] == BOTTOM || dirs[1] == BOTTOM) ? '#' : '.'; line += "."; line += (dirs[0] == BOTTOM_RIGHT || dirs[1] == BOTTOM_RIGHT) ? '#' : '.'; line += ".."; std::cout << line << "\n"; line = ""; line += "."; line += (dirs[0] == BOTTOM_LEFT || dirs[1] == BOTTOM_LEFT) ? '#' : '.'; line += ".."; line += (dirs[0] == BOTTOM || dirs[1] == BOTTOM) ? '#' : '.'; line += ".."; line += (dirs[0] == BOTTOM_RIGHT || dirs[1] == BOTTOM_RIGHT) ? '#' : '.'; line += "."; std::cout << line << "\n"; std::cout << "........." << std::endl; } }; static std::map wordToChar; static std::map charToWord; char caesarCipher(char input, int c){ int letterNum = input - 65; letterNum += c; letterNum %= 26; letterNum += 65; return letterNum; } int main() { std::ios_base::sync_with_stdio(false); using enum Direction; wordToChar.emplace(Word(BOTTOM_LEFT, BOTTOM), 'A'); charToWord.emplace('A', Word(BOTTOM_LEFT, BOTTOM)); wordToChar.emplace(Word(LEFT, BOTTOM), 'B'); charToWord.emplace('B', Word(LEFT, BOTTOM)); wordToChar.emplace(Word(TOP_LEFT, BOTTOM), 'C'); charToWord.emplace('C', Word(TOP_LEFT, BOTTOM)); wordToChar.emplace(Word(TOP, BOTTOM), 'D'); charToWord.emplace('D', Word(TOP, BOTTOM)); wordToChar.emplace(Word(TOP_RIGHT, BOTTOM), 'E'); charToWord.emplace('E', Word(TOP_RIGHT, BOTTOM)); wordToChar.emplace(Word(RIGHT, BOTTOM), 'F'); charToWord.emplace('F', Word(RIGHT, BOTTOM)); wordToChar.emplace(Word(BOTTOM, BOTTOM_RIGHT), 'G'); charToWord.emplace('G', Word(BOTTOM, BOTTOM_RIGHT)); wordToChar.emplace(Word(LEFT, BOTTOM_LEFT), 'H'); charToWord.emplace('H', Word(LEFT, BOTTOM_LEFT)); wordToChar.emplace(Word(TOP_LEFT, BOTTOM_LEFT), 'I'); charToWord.emplace('I', Word(TOP_LEFT, BOTTOM_LEFT)); wordToChar.emplace(Word(TOP, RIGHT), 'J'); charToWord.emplace('J', Word(TOP, RIGHT)); wordToChar.emplace(Word(TOP, BOTTOM_LEFT), 'K'); charToWord.emplace('K', Word(TOP, BOTTOM_LEFT)); wordToChar.emplace(Word(TOP_RIGHT, BOTTOM_LEFT), 'L'); charToWord.emplace('L', Word(TOP_RIGHT, BOTTOM_LEFT)); wordToChar.emplace(Word(RIGHT, BOTTOM_LEFT), 'M'); charToWord.emplace('M', Word(RIGHT, BOTTOM_LEFT)); wordToChar.emplace(Word(BOTTOM_LEFT, BOTTOM_RIGHT), 'N'); charToWord.emplace('N', Word(BOTTOM_LEFT, BOTTOM_RIGHT)); wordToChar.emplace(Word(TOP_LEFT, LEFT), 'O'); charToWord.emplace('O', Word(TOP_LEFT, LEFT)); wordToChar.emplace(Word(TOP, LEFT), 'P'); charToWord.emplace('P', Word(TOP, LEFT)); wordToChar.emplace(Word(TOP_RIGHT, LEFT), 'Q'); charToWord.emplace('Q', Word(TOP_RIGHT, LEFT)); wordToChar.emplace(Word(LEFT, RIGHT), 'R'); charToWord.emplace('R', Word(LEFT, RIGHT)); wordToChar.emplace(Word(LEFT, BOTTOM_RIGHT), 'S'); charToWord.emplace('S', Word(LEFT, BOTTOM_RIGHT)); wordToChar.emplace(Word(TOP_LEFT, TOP), 'T'); charToWord.emplace('T', Word(TOP_LEFT, TOP)); wordToChar.emplace(Word(TOP_LEFT, TOP_RIGHT), 'U'); charToWord.emplace('U', Word(TOP_LEFT, TOP_RIGHT)); wordToChar.emplace(Word(TOP, BOTTOM_RIGHT), 'V'); charToWord.emplace('V', Word(TOP, BOTTOM_RIGHT)); wordToChar.emplace(Word(TOP_RIGHT, RIGHT), 'W'); charToWord.emplace('W', Word(TOP_RIGHT, RIGHT)); wordToChar.emplace(Word(TOP_RIGHT, BOTTOM_RIGHT), 'X'); charToWord.emplace('X', Word(TOP_RIGHT, BOTTOM_RIGHT)); wordToChar.emplace(Word(TOP_LEFT, RIGHT), 'Y'); charToWord.emplace('Y', Word(TOP_LEFT, RIGHT)); wordToChar.emplace(Word(RIGHT, BOTTOM_RIGHT), 'Z'); charToWord.emplace('Z', Word(RIGHT, BOTTOM_RIGHT)); int wordCount, caesarConst; //std::scanf("%d %d ", &wordCount, &caesarConst); std::cin >> wordCount; std::cin >> caesarConst; std::cin.get(); caesarConst = caesarConst % 26; std::vector rawWords; for (int i = 0; i < wordCount; i++) { rawWords.emplace_back(Word(i+1 == wordCount)); } std::vector unCaesaredString; for (int i = 0; i < wordCount; i++) { unCaesaredString.emplace_back(wordToChar[rawWords[i]]); } std::vector caesaredString; for (int i = 0; i < wordCount; i++) { caesaredString.emplace_back(caesarCipher(unCaesaredString[i], caesarConst)); } for (int i = 0; i < wordCount; i++) { charToWord[caesaredString[i]].print(); } return 0; }