Submission #3255548


Source Code Expand

Copy
S = input()
T = input()

d_S = [[] for _ in range(26)]
d_T = [[] for _ in range(26)]

for i in range(len(S)):
    d_S[ord(S[i])-97].append(i)
    d_T[ord(T[i])-97].append(i)

for i in range(26):
    tmp = ""
    for j in d_S[i]:
        if tmp == "":
            tmp = T[j]
        else:
            if tmp != T[j]:
                print("No")
                break
    else:
        continue
    break
else:
    for i in range(26):
        tmp = ""
        for j in d_T[i]:
            if tmp == "":
                tmp = S[j]
            else:
                if tmp != S[j]:
                    print("No")
                    break
        else:
            continue
        break
    else:
        print("Yes")

Submission Info

Submission Time
Task C - String Transformation
User lisbun
Language Python3 (3.4.3)
Score 300
Code Size 753 Byte
Status
Exec Time 158 ms
Memory 14512 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 17 ms 3064 KB
0_min1 17 ms 3064 KB
1_small0 17 ms 3064 KB
1_small1 17 ms 3064 KB
1_small2 17 ms 3064 KB
2_medium0 90 ms 11736 KB
2_medium1 115 ms 10604 KB
2_medium2 42 ms 4852 KB
2_medium3 130 ms 13120 KB
2_medium4 112 ms 11236 KB
3_max0 120 ms 14384 KB
3_max1 158 ms 14512 KB
3_max2 154 ms 14512 KB
3_max3 140 ms 13872 KB
3_max4 129 ms 14256 KB
3_max5 111 ms 12968 KB
3_max6 149 ms 12972 KB
3_max7 147 ms 12916 KB
3_max8 115 ms 13024 KB
3_max9 145 ms 13316 KB
5_hand0 17 ms 3064 KB
sample_01 17 ms 3064 KB
sample_02 17 ms 3064 KB
sample_03 17 ms 3064 KB