ผลต่างระหว่างรุ่นของ "01204212/statuses"
ไปยังการนำทาง
ไปยังการค้นหา
Jittat (คุย | มีส่วนร่วม) |
Jittat (คุย | มีส่วนร่วม) |
||
| แถว 18: | แถว 18: | ||
5 when_it_is_ok | 5 when_it_is_ok | ||
</pre> | </pre> | ||
| + | |||
| + | '''Output example''' | ||
For this input, the expected report would be (see the description of the output at the end): | For this input, the expected report would be (see the description of the output at the end): | ||
| แถว 30: | แถว 32: | ||
- 4 good_morning_thailand | - 4 good_morning_thailand | ||
</pre> | </pre> | ||
| + | |||
| + | '''Test data:''' [http://theory.cpe.ku.ac.th/~jittat/courses/01204212/tasks/comments/ Download here] | ||
รุ่นแก้ไขเมื่อ 22:48, 17 สิงหาคม 2559
You are given an information on comments are posted. You want to print out a report on that in a nicely form.
Input
- First line: integer n (the number of comments)
- The next n lines, each line specify a comment. Line i + 1 for 1<=i<=n specifies the i-th comment. In this line, there is an integer p (p < i) and a string s (consiting of a - z and an underline (_) whose length is at most 30). This comment replies to the p-th comment. If p=0, this comment replies to the status itself. The string s is the comment text.
Input example
7 0 hello_world 0 this_is_another_comment 1 first_reply 2 good_morning_thailand 1 second_one 1 third_one 5 when_it_is_ok
Output example
For this input, the expected report would be (see the description of the output at the end):
- 1 hello_world
- 3 first_reply
- 5 second_one
- 7 when_it_is_ok
- 6 third_one
- 2 this_is_another_comment
- 4 good_morning_thailand
Test data: Download here