require 'set'
loop do
    l = gets.chomp
    break if l == "0 0"
    answer, call = l.split.map {|s| s.split("")}
    hit = answer.zip(call).select {|a| a.inject(:==)}.size
    blow = (Set[*answer] & Set[*call]).size - hit
    puts "#{hit} #{blow}"
end
