LCC '21 Contest 3 S2 - Replacement Strings
View as PDFOscar has two strings of length , string
and string
. He wonders the following question:
Is it possible to turn string into string
by substituting all instances of one letter with another letter?
Input Specification
The first line of input contains an integer, .
The second line of input contains a string,
.
The third line of input contains a string,
.
Strings and
will consist of lowercase letters only.
Output Specification
Output yes or no in response to Oscar's question.
Sample Input 1
5
enels
nnnls
Sample Output 1
yes
Explanation
If you replace all occurences of e in string with
n, you get string .
Sample Input 2
5
enels
enenn
Sample Output 2
no
Explanation
There is no way to make string the same as string
by replacing all instances of one letter with another. If you were to replace all instances of
l with n, you would get the string enens. If you were to replace all instances of s with n, you would get the string eneln. Neither of these results equal the target string, enenn.
Sample Input 3
5
enels
ennls
Sample Output 3
no
Explanation
There is no way to make string the same as string
by replacing all instances of one letter with another. If you were to replace all instances of
e with n, you get the string nnnls, which doesn't equal the target string, ennls.
Comments