solve2 :: String -> Int
solve2 numbers = sum $ map (\n -> (fromEnum n) - 48) numbers

main = do
  strings <- fmap (takeWhile (/= "0") . lines) getContents
  let ints = map solve2 $ strings
  mapM_ (putStrLn . show) $ ints

