#!/usr/bin/env python3 import sys # Constants for ASCII art generation. SHAPE_HEIGHT = 5 SEPARATOR = ".." # Letter templates designed with specific shapes and variable widths. # The hole counts for each shape are designed to match the problem's rules. # '*' is a placeholder for the character, ' ' will be replaced by '.'. LETTER_TEMPLATES = { # 0 holes 'E': [ "***", "* ", "***", "* ", "***" ], 'G': [ "***", "* ", "* *", "* *", "***" ], 'I': [ "***", " * ", " * ", " * ", "***" ], 'L': [ "* ", "* ", "* ", "* ", "***" ], 'N': [ "* *", "** ", "* *", "* *", "* *" ], 'T': [ "***", " * ", " * ", " * ", " * " ], 'U': [ "* *", "* *", "* *", "* *", "***" ], 'V': [ "* *", "* *", "* *", " * ", " * " ], 'W': [ "* *", "* * *", "* * *", "* * *", " * * " ], 'Y': [ "* *", " * ", " * ", " * ", " * " ], # 1 hole 'A': [ "***", "* *", "***", "* *", "* *" ], 'D': [ "** ", "* *", "* *", "* *", "** " ], 'O': [ "***", "* *", "* *", "* *", "***" ], 'R': [ "***", "* *", "** ", "* *", "* *" ], # 2 holes 'B': [ "***", "* *", "***", "* *", "***" ], } def fill_template_row(template_row, char): """Fills a placeholder template row with the given character and dots.""" return template_row.replace('*', char).replace(' ', '.') def solve(): """ Main function to solve the problem. Reads the two color names, generates the corresponding captcha, and prints it. """ try: # Read the two color names from standard input. c1_human_readable = sys.stdin.readline().strip() c2_llm_readable = sys.stdin.readline().strip() except (IOError, ValueError): # Gracefully handle empty input or end-of-file. return if not c1_human_readable or not c2_llm_readable: return # 1. Calculate the total width based on the variable widths of each character in C1. char_widths = [len(LETTER_TEMPLATES[c][0]) for c in c1_human_readable] num_chars_c1 = len(c1_human_readable) art_width = sum(char_widths) + \ ((num_chars_c1 - 1) * len(SEPARATOR)) if num_chars_c1 > 0 else 0 # 2. Generate and print the ASCII art lines for C1. for r in range(SHAPE_HEIGHT): line_parts = [] for char_to_draw in c1_human_readable: template_row = LETTER_TEMPLATES[char_to_draw][r] filled_row = fill_template_row(template_row, char_to_draw) line_parts.append(filled_row) # Join the parts of the line with the separator and print. print(SEPARATOR.join(line_parts)) # 3. Generate and print the text line for C2. text_pattern = c2_llm_readable + "." full_text_line = "" # Repeat the pattern until the line is long enough. while len(full_text_line) < art_width: full_text_line += text_pattern # Truncate the line to the exact width to form a rectangle. final_text_line = full_text_line[:art_width] print(final_text_line) if __name__ == "__main__": solve()