Editorial for COCI '10 Contest 4 #1 Avion
Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.
Submitting an official solution before solving the problem yourself is a bannable offence.
This problem is straightforward. For each of the five lines of input, we check whether it contains a substring FBI
. We can use existing functions: pos
in Pascal, strpos
in C, and string.find()
in C++. We must also detect if the substring is not present in any of the given strings. This is done easily. At the beginning, we set some flag to zero. If we find the substring FBI
, we set that flag to one. At the end, if the flag is still zero, we output HE GOT AWAY!
.
This problem can be solved using loops, but this is not required since the number of given strings is always .
Comments