module BloodType def solve(s, t) a = {:A => 0, :B => 0, :AB => 0, :O => 0} (0..1).each do |i| (0..1).each do |j| a[child_blood_type(s[i], t[j])] += 1 end end a.values.map{_1 * 25} end def child_blood_type(p1, p2) case [p1, p2] when ["A", "A"] :A when ["A", "B"] :AB when ["A", "O"] :A when ["B", "A"] :AB when ["B", "B"] :B when ["B", "O"] :B when ["O", "A"] :A when ["O", "B"] :B when ["O", "O"] :O end end module_function :solve, :child_blood_type end s = gets.chomp t = gets.chomp puts BloodType.solve(s, t).join(" ")