Submission #3255573


Source Code Expand

Copy
def solve():
    s = input()
    t = input()
    d0 = {}
    d1 = {}
    if len(s) != len(t):
        print('No')
        return
    for i in range(len(s)):
        if s[i] in d0:
            if t[i] != d0[s[i]]:
                print('No')
                return
        elif t[i] in d1:
            if s[i] != d1[t[i]]:
                print('No')
                return
        else:
            d0[s[i]] = t[i]
            d1[t[i]] = s[i]
    print('Yes')


solve()

Submission Info

Submission Time
Task C - String Transformation
User taku0728
Language PyPy3 (2.4.0)
Score 300
Code Size 494 Byte
Status
Exec Time 180 ms
Memory 41584 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 sample_01, sample_02, sample_03
All 300 / 300 0_min0, 0_min1, 1_small0, 1_small1, 1_small2, 2_medium0, 2_medium1, 2_medium2, 2_medium3, 2_medium4, 3_max0, 3_max1, 3_max2, 3_max3, 3_max4, 3_max5, 3_max6, 3_max7, 3_max8, 3_max9, 5_hand0, sample_01, sample_02, sample_03
Case Name Status Exec Time Memory
0_min0 161 ms 38256 KB
0_min1 167 ms 38256 KB
1_small0 165 ms 38256 KB
1_small1 162 ms 38256 KB
1_small2 161 ms 38256 KB
2_medium0 171 ms 40688 KB
2_medium1 180 ms 41456 KB
2_medium2 167 ms 39024 KB
2_medium3 174 ms 41328 KB
2_medium4 171 ms 40816 KB
3_max0 168 ms 41456 KB
3_max1 180 ms 41584 KB
3_max2 166 ms 41456 KB
3_max3 173 ms 41584 KB
3_max4 171 ms 41584 KB
3_max5 172 ms 41456 KB
3_max6 178 ms 41584 KB
3_max7 174 ms 41584 KB
3_max8 178 ms 41584 KB
3_max9 176 ms 41584 KB
5_hand0 165 ms 38256 KB
sample_01 163 ms 38256 KB
sample_02 164 ms 38256 KB
sample_03 161 ms 38256 KB