atcoder#ABC303A. [ABC303A] Similar String
[ABC303A] Similar String
Score : points
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.
3
l0w
1ow
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.
3
abc
arc
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.
4
nok0
n0ko
Yes