#C464. Restore the Necklace

    ID: 48200 Type: Default 1000ms 256MiB

Restore the Necklace

Restore the Necklace

We are given a necklace represented as a string containing lowercase letters and the '?' character, which denotes an unknown bead. The task is to replace each '?' with a lowercase letter such that no two adjacent beads have the same color. All fixed beads (non-'?') must remain unchanged. If it is impossible to create a valid necklace, output (\text{IMPOSSIBLE}).

The substitutions must be chosen from the set ({a, b, c, \dots, z}), and the final necklace configuration must satisfy the condition that for every index (i), (s_i \neq s_{i+1}).

inputFormat

The input is provided via standard input (stdin) as a single line containing a string (s) representing the necklace. The string consists of lowercase letters and the character '?' representing unknown beads.

outputFormat

Output a single line to standard output (stdout) — the resulting necklace after replacing all '?' characters with valid lowercase letters. If no valid configuration exists, output the string "IMPOSSIBLE".## sample

a?b
acb