#K85587. Collapsible Sections Identification
Collapsible Sections Identification
Collapsible Sections Identification
In this problem, you are given several lines of code and your task is to identify collapsible sections based on specific markers. A collapsible section starts at the first occurrence of the keyword START
and ends at the subsequent occurrence of the keyword END
in the code. You should use 1-indexed line numbering. For each identified section, output a line in the following format:
where (X) is the starting line number and (Y) is the ending line number of the section. If no valid section exists, the output should be empty.
Read the input from stdin
and write the result to stdout
.
inputFormat
The input consists of multiple lines of text representing code. Each line may contain arbitrary text. The markers START
and END
define the beginning and end of a collapsible section, respectively. The code is read from stdin
.
outputFormat
For each collapsible section identified, output a line in the following format:
Section from line X to line Y
where X and Y are the starting and ending line numbers (using 1-indexing) of the section. If there are multiple sections, output each on a new line. If no section is found, output nothing.## sample
int main() {
// Code before section
START
int a = 0;
int b = 1;
END
// Code after section
}
Section from line 3 to line 6