#abc303a. A - Similar String
A - Similar String
Score : points
问题描述
设两个字符 和 被称为相似字符,当且仅当满足以下任一条件:
- 和 是相同的字符。
- 和 中有一个是
1
,另一个是l
。 - 和 中有一个是
0
,另一个是o
。
两个长度均为 的字符串 和 称为相似字符串,当且仅当:
- 对于所有 ,第 个字符的 和第 个字符的 是相似字符。
给定两个由小写英文字母和数字组成的长度为 的字符串 和 ,判断 和 是否为相似字符串。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
Two characters and are called similar characters if and only if one of the following conditions is satisfied:
- and are the same character.
- One of and is
1
and the other isl
. - One of and is
0
and the other iso
.
Two strings and , each of length , are called similar strings if and only if:
- for all , the -th character of and the -th character of are similar characters.
Given two length- strings and consisting of lowercase English letters and digits, determine if and are similar strings.
Constraints
- is an integer between and .
- Each of and is a string of length consisting of lowercase English letters and digits.
Input
The input is given from Standard Input in the following format:
Output
Print Yes
if and are similar strings, and No
otherwise.
Sample Input 1
3
l0w
1ow
Sample Output 1
Yes
The -st character of is l
, and the -st character of is 1
. These are similar characters.
The -nd character of is 0
, and the -nd character of is o
. These are similar characters.
The -rd character of is w
, and the -rd character of is w
. These are similar characters.
Thus, and are similar strings.
Sample Input 2
3
abc
arc
Sample Output 2
No
The -nd character of is b
, and the -nd character of is r
. These are not similar characters.
Thus, and are not similar strings.
Sample Input 3
4
nok0
n0ko
Sample Output 3
Yes
update @ 2024/3/10 08:30:48