Editorial for COCI '13 Contest 6 #1 Vjeko
Submitting an official solution before solving the problem yourself is a bannable offence.
We will split the sample into two parts; the first part being before the asterisk (let us call it ) and the second part after the asterisk (let us call it
). The file name matches the pattern if it is in the form of
, where
is some string (possibly an empty one). Therefore, the file name must begin with
and end with
. However, this is not a sufficient condition.
If we take the sample ab*bc
, we have
ab
and
bc
. The file name abc
begins with and ends with
, but it still doesn't match the sample
ab*bc
. It is necessary to check whether and
overlap in the file name. In other words, is
?
Hence, if a word doesn't begin with or doesn't end with
or the aforementioned condition with lengths is met, we output
NE
(Croatian for no), else we output DA
(Croatian for yes).
A solution which does not check whether and
overlap is sufficient for
of points.
Comments