B. 通配符 / Wild Card

    传统题 1000ms 256MiB

通配符 / Wild Card

该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。

Problem Statement

SS is a string of length NN consisting of lowercase English letters. TT is a string of length NN consisting of lowercase English letters and *.

We say that SS matches TT if and only if TT can be made equal to SS by replacing each * in TT with some lowercase English letter.

Determine whether SS matches TT.

Constraints

  • 1≤N≤1001 \leq N \leq 100
  • SS is a string of length NN consisting of lowercase English letters.
  • TT is a string of length NN consisting of lowercase English letters and *.

Input

The input is given from Standard Input in the following format:

  • NN
  • SS
  • TT

Output

Output Yes if SS matches TT, and No otherwise, in one line.

8
chokudai
**o*u*ai
Yes

By replacing the first, second, fourth, and sixth characters of TT, which are *, with c, h, k, and d, respectively, TT can be made equal to SS.

5
snuke
snake
No
5
yiwiy
*****
Yes

ABC476 赛后模拟赛 ✅️

未参加
状态
已结束
规则
IOI
题目
7
开始于
2026-9-19 21:40
结束于
2026-10-10 21:40
持续时间
504 小时
主持人
参赛人数
35