시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 | 128 MB | 9 | 7 | 7 | 77.778% |
When analyzing source code in some programming language, it’s sometimes useful to know if there are some functions that will never execute. If there are, that may lead to an error in the code.
In this occasion we observe simple programming language that consists of following functions:
RADI
: program continues to next functionIDI a
: program goes to a-th functionIDI a ILI b
: program goes to a-th or b-th functionProgram always starts at first function.
Write the program that will calculate the number of functions that will never execute.
In every line of input file there is one function, in i-th line there is i-th function.
In last line (after last function, i+1-th line) there is ‘.’ (a spot). That line is not the part of a program and is not considered function.
Number of functions will be less or equal then 10,000.
In first and only line of output should be printed the number of unexecuted functions.
RADI IDI 4 ILI 6 RADI IDI 3 RADI IDI 8 RADI RADI .
2
IDI 1 RADI .
1
RADI IDI 4 ILI 6 RADI IDI 3 RADI IDI 8 RADI RADI .
2