#abc303a. A - Similar String

A - Similar String

Score : 100100 points

问题描述

设两个字符 xxyy 被称为相似字符,当且仅当满足以下任一条件:

  • xxyy 是相同的字符。
  • xxyy 中有一个是 1,另一个是 l
  • xxyy 中有一个是 0,另一个是 o

两个长度均为 NN 的字符串 SSTT 称为相似字符串,当且仅当:

  • 对于所有 i (1iN)i\ (1\leq i\leq N),第 ii 个字符的 SS 和第 ii 个字符的 TT 是相似字符。

给定两个由小写英文字母和数字组成的长度为 NN 的字符串 SSTT,判断 SSTT 是否为相似字符串。

以上为通义千问 qwen-max 翻译,仅供参考。

Problem Statement

Two characters xx and yy are called similar characters if and only if one of the following conditions is satisfied:

  • xx and yy are the same character.
  • One of xx and yy is 1 and the other is l.
  • One of xx and yy is 0 and the other is o.

Two strings SS and TT, each of length NN, are called similar strings if and only if:

  • for all i (1iN)i\ (1\leq i\leq N), the ii-th character of SS and the ii-th character of TT are similar characters.

Given two length-NN strings SS and TT consisting of lowercase English letters and digits, determine if SS and TT are similar strings.

Constraints

  • NN is an integer between 11 and 100100.
  • Each of SS and TT is a string of length NN consisting of lowercase English letters and digits.

Input

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

NN

SS

TT

Output

Print Yes if SS and TT are similar strings, and No otherwise.

Sample Input 1

3
l0w
1ow

Sample Output 1

Yes

The 11-st character of SS is l, and the 11-st character of TT is 1. These are similar characters.

The 22-nd character of SS is 0, and the 22-nd character of TT is o. These are similar characters.

The 33-rd character of SS is w, and the 33-rd character of TT is w. These are similar characters.

Thus, SS and TT are similar strings.

Sample Input 2

3
abc
arc

Sample Output 2

No

The 22-nd character of SS is b, and the 22-nd character of TT is r. These are not similar characters.

Thus, SS and TT are not similar strings.

Sample Input 3

4
nok0
n0ko

Sample Output 3

Yes

update @ 2024/3/10 08:30:48