Submission #3252530

Source Code Expand

Copy
S = gets.chomp
T = gets.chomp
N = S.length

map = Hash.new

N.times do |i|
    if map[S[i]] && map[S[i]] != T[i]
        puts 'No'
        exit
    end
    map[S[i]] = T[i]
end

if map.length != map.values.uniq.length
    puts 'No'
else
    puts 'Yes'
end

Submission Info

Submission Time
Task C - String Transformation
User betrue12
Language Ruby (2.3.3)
Score 300
Code Size 273 Byte
Status
Exec Time 193 ms
Memory 2624 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 7 ms 1788 KB
0_min1 7 ms 1788 KB
1_small0 7 ms 1788 KB
1_small1 7 ms 1788 KB
1_small2 7 ms 1788 KB
2_medium0 7 ms 2428 KB
2_medium1 135 ms 2300 KB
2_medium2 41 ms 1916 KB
2_medium3 173 ms 2428 KB
2_medium4 32 ms 2300 KB
3_max0 7 ms 2624 KB
3_max1 190 ms 2624 KB
3_max2 191 ms 2624 KB
3_max3 193 ms 2624 KB
3_max4 28 ms 2624 KB
3_max5 7 ms 2624 KB
3_max6 188 ms 2624 KB
3_max7 114 ms 2624 KB
3_max8 111 ms 2624 KB
3_max9 184 ms 2624 KB
5_hand0 7 ms 1788 KB
sample_01 7 ms 1788 KB
sample_02 7 ms 1788 KB
sample_03 7 ms 1788 KB