Skip to content

Commit 44aefc1

Browse files
committedAug 14, 2019
2019-08-13
1 parent 2bd169d commit 44aefc1

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
 
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
class Solution(object):
2+
def canConvert(self, str1, str2):
3+
"""
4+
:type str1: str
5+
:type str2: str
6+
:rtype: bool
7+
"""
8+
if str1 == str2:
9+
return True
10+
11+
mapping = dict()
12+
for i, char in enumerate(str1):
13+
if str2[i] != char:#ÐèҪת»¯
14+
if char in mapping: #ÒѾ­ÓжÔÓ¦ÁË
15+
if mapping[char] != str2[i]:
16+
return False
17+
else:
18+
mapping[char] = str2[i]
19+
20+
if len(set(str1)) == 26 and len(set(str2)) == 26:
21+
return False
22+
return True

0 commit comments

Comments
 (0)