100762: [AtCoder]ABC076 C - Dubious Document 2

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Score : $300$ points

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.


Sample Input 1

?tc????
coder

Sample 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.


Sample Input 2

??p??d??
abc

Sample Output 2

UNRESTORABLE

There is no string that satisfies Condition 1, so the string $S$ does not exist.

Input

题意翻译

你找到了一个装着宝物的箱子,但箱子被锁住了,密码是一个字符串 $S$ 。 但是你手中的密码字符串 $S'$ 是不完整的,残缺的部分用 `?` 替代。你还找到一张纸条,上面有一个串 $T$ 。 已知 $T$ 为 $S$ 的子串。你需要破解这个密码,请输出密码所有可能中字典序最小的代码。如果没有符合的密码,请输出一个字符串 `UNRESTORABLE` 。 $S,S',T$ 的长度均小于 50 ,所有字符均为小写字母或 `?` 。

加入题单

上一题 下一题 算法标签: