#C11739. Counting Lowercase Variables
Counting Lowercase Variables
Counting Lowercase Variables
This problem requires you to parse a mathematical expression and count the occurrences of each single lowercase variable. Only variables that consist of a single lowercase letter (a to z) are considered valid. The expression can include numbers, arithmetic operators, and spaces.
For example, given the expression \(3 * a + 4 / b - 5 * c\), the correct count is \(\{a: 1, b: 1, c: 1\}\). Your task is to output the counts in alphabetical order where each line contains the variable followed by its count.
inputFormat
The input consists of a single line containing the mathematical expression. The expression may include numbers, operators (+, -, *, /), and variables. Only single lowercase letters that are isolated (not part of a multi-character identifier) should be counted.
outputFormat
For each variable found in the expression, output a line with the variable and its occurrence count separated by a space. The output should be sorted in alphabetical order by the variable. If no lowercase variables are found, output nothing.
## sample3 * a + 4 / b - 5 * c
a 1
b 1
c 1
</p>