-->
当前位置:首页 > 题库

PROGRAMMING:Split expression -- write a tokenizer

Luz5年前 (2021-05-10)题库478
**[start with the background]**
This topic is for junior students and students learning C language, because for this part of students, the topic is a little complicated. If you are a senior, have studied regular expression or have studied OO language such as Java, you should find that this problem is relatively simple. Oh, by the way, what is a tokenizer? Please inquire and solve by yourself. It should not be translated as "token parser" here.
**[Topic]**
The four Operational expressions are composed of * * operands * * (which must contain 'number', and may contain 'positive or negative sign','decimal point ', * * * (including' + ',' - ',' * ',' / ') and parentheses (' (` and ')). Each operand, operator and parenthesis is a * token *. Now, for a given four arithmetic expression, please segment each token. The title guarantees that the given expression is correct and does not need to be checked for validity.
###Input format:
In one line, an expression with a length of no more than 40 characters is given, in which there are no spaces, and it is only composed of the characters of the token mentioned above
###Output format:
Output the tokens in the expression in turn, and each token occupies one line.
###Input example:
```in
32*((2-2)+5)/(-15)
```
###Output example:
```out
thirty-two
*
(
(
two
-
two
)
+
five
)
/
(
-15
)
```






answer:If there is no answer, please comment