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

PROGRAMMING:Geometry lessons

Luz5年前 (2021-05-10)题库442
Xiao Ming saw that the class week of a course in the timetable was marked like this: 1, 8, 12-17, 3-6. Please write a program to convert the week representation string from the input device into the standard week representation.
###Input format:
A number represents a week, the interval between the two numbers separated by a - sign represents a week, and A-B represents the interval [a, b]. The program ensures that a < B, but cannot ensure that the weeks are arranged in ascending order. All weeks are within [1,20].
Enter the class week of a course in several lines.
###Output format:
Output the weeks with courses in order from small to large, the weeks are separated by commas, and there is no comma at last.
###Input example:
```in
3-5,8,13-15,17,10-12
13-18,5-9
3-13 , 13 - 17
```
###Output example:
```out
3,4,5,8,10,11,12,13,14,15,17
5,6,7,8,9,13,14,15,16,17,18
3,4,5,6,7,8,9,10,11,12,13,14,15,16,17
```







answer:If there is no answer, please comment