Problem
Input format
The program reads from standard input a single line containing the expression (at most 1000 characters long). - Length of expression <= 1000. - The expression may or may not be syntactically valid; the program only counts tokens.
Output format
The program prints to standard output two non-negative integers separated by a space: the number of operands, then the number of operators.
Example
(2+3)*(4-1)
4 3
Stuck?
Use the Get Hint button in the action bar to reveal a guided hint.
💬 Discussion
Loading...No comments yet. Be the first to start the discussion!
Sample cases (from the problem)
Sample Case 1
(2+3)*(4-1)
4 3
Solve it your way first
Community solutions unlock after you submit a passing solution. Don't peek.
Ready to solve this challenge?
Create a free account to write code, submit solutions, and track your progress.