S = gets.chomp T = gets.chomp a, b, ab, o = 0, 0, 0, 0 S.each_char do |s| T.each_char do |t| if s == "A" && (t == "A" || t == "O") a += 1 elsif s == "B" && (t == "B" || t == "O") b += 1 elsif t == "A" && (s == "A" || s == "O") a += 1 elsif t == "B" && (s == "B" || s == "O") b += 1 elsif (s == "A" && t == "B") || (s == "B" && t == "A") ab += 1 else o += 1 end end end puts "#{a*25} #{b*25} #{ab*25} #{o*25}"