import Control.Monad
import Control.Applicative

hit :: String -> String -> Int
hit [] _ = 0
hit _ [] = 0
hit (r:rs) (a:as) =
  if r == a
    then 1 + hit rs as
  else hit rs as

blow :: String -> String -> Int -> Int
blow [] _ _ = 0
blow _ [] _ = 0
blow rs as n =
  if n >= 4
    then 0
    else
      let r = rs !! n
      in
        if r /= as !! n && r `elem` as
          then 1 + blow rs as (n+1)
          else blow rs as (n+1)

solver :: String -> String -> String
solver r a = show (hit r a) ++ " " ++ show (blow r a 0)

main :: IO()
main = do
  (r:a:_) <- words <$> getLine
  unless (r == "0" && a == "0") $ do
    putStrLn $ solver r a
    main