Editorial for COCI '13 Contest 6 #1 Vjeko


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.

We will split the sample into two parts; the first part being before the asterisk (let us call it S) and the second part after the asterisk (let us call it T). The file name matches the pattern if it is in the form of S+R+T, where R is some string (possibly an empty one). Therefore, the file name must begin with S and end with T. However, this is not a sufficient condition.

If we take the sample ab*bc, we have S = ab and T = bc. The file name abc begins with S and ends with T, but it still doesn't match the sample ab*bc. It is necessary to check whether S and T overlap in the file name. In other words, is |S|+|T| > |\text{file name}|?

Hence, if a word doesn't begin with S or doesn't end with T 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 S and T overlap is sufficient for 50\% of points.


Comments

There are no comments at the moment.