AtCoder Beginner Contest 076
翻译中…
Problem Statement
翻译中…
E869120 found a chest which is likely to contain treasure.
However, the chest is locked. In order to open it, he needs to enter a string $S$ consisting of lowercase English letters.
He also found a string $S'$, which turns out to be the string $S$ with some of its letters (possibly all or none) replaced with ?.
翻译中…
One more thing he found is a sheet of paper with the following facts written on it:
翻译中…
- Condition 1: The string
$S$contains a string$T$as a contiguous substring. - Condition 2:
$S$is the lexicographically smallest string among the ones that satisfy Condition 1.
翻译中…
Print the string $S$.
If such a string does not exist, print UNRESTORABLE.
翻译中…
Constraints
翻译中…
$1 \leq |S'|, |T| \leq 50$$S'$consists of lowercase English letters and?.$T$consists of lowercase English letters.
翻译中…
Input
翻译中…
Input is given from Standard Input in the following format:
翻译中…
S
T'
翻译中…
Output
翻译中…
Print the string $S$.
If such a string does not exist, print UNRESTORABLE instead.
翻译中…
样例
Input #1
?tc????
coder
Output #1
atcoder
There are $26$ strings that satisfy Condition 1: `atcoder`, `btcoder`, `ctcoder`,..., `ztcoder`. Among them, the lexicographically smallest is `atcoder`, so we can say $S =$`atcoder`.
Input #2
??p??d??
abc
Output #2
UNRESTORABLE
There is no string that satisfies Condition 1, so the string $S$ does not exist.
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。