Messy Ledger (Error Handling)

Read a line of tokens. Add up every token that is a valid integer (optional -), skip the rest, and print sum S, skipped K.

Input: One line of tokens.

Output: sum S, skipped K.

Difficulty: Medium. Write your answer in the browser editor, run the examples, then submit it against hidden tests. Python and JavaScript are free; other languages are part of licode Club.

Hint

  • Try to parse each token and handle the failure.

More Error Handling practice