Grid Coloring I
#3311Ask AI
Open a hint-first prompt in a new AI chat. Grok may ask you to confirm before sending.
Open Claude DesktopYou are given an grid where each cell contains one character A, B, C or D.
For each cell, you must change the character to A, B, C or D. The new character must be different from the old one.
Your task is to change the characters in every cell such that no two adjacent cells have the same character.
Input
The first line has two integers and : the number of rows and columns.
The next lines each have characters: the description of the grid.
Output
Print lines each with characters: the description of the final grid.
You may print any valid solution.
If no solution exists, just print IMPOSSIBLE.
3 4 AAAA BBBB CCDD
CDCD DCDC ABAB
Tools
3 4 AAAA BBBB CCDD
CDCD DCDC ABAB