main :: IO ()
main = do
  ls <- getContents
  let ls' = remake $ lines ls
      ansl = map (format . point') ls'
  mapM_ putStrLn ansl
remake :: [String] -> [String]
remake [] = []
remake ("0":[]) = []
remake (x:"0":[]) = [(tail x)]
remake (x:y:r) = ((tail x) ++ [head y]):(remake (y:r))

point :: String -> (Int,Int) -> (Int,Int)
point [] (a,b) = (a,b)
point ('A':r) (a,b) = point r (a+1,b)
point ('B':r) (a,b) = point r (a,b+1)

point' :: String -> (Int,Int)
point' s
  | a < b && b < 11 = (a,b+1)
  | a > b && a < 11 = (a+1,b)
  | otherwise = (a,b)
  where t = point s (0,0)
        a = fst t
        b = snd t

format :: (Int,Int) -> String
format (a,b) = (show a) ++ " " ++ (show b)