Editorial for COCI '09 Contest 1 #3 Dobra
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.
At first, you could notice there are ways one can substitute _
with a letter. Trying all combinations would not be solvable in the constraints given in this task. However there are only 3 classes of substitution:
- substitute with a vowel
- substitute with the letter
L
- substitute with a consonant different from
L
The first class contains letters, the second class letter and the third class letters.
The constraints were small enough that you can now solve the problem by checking all possible combinations of these three classes for each _
. Of course you need to take care not to count illegal combinations. A good way to do that is to monitor the last two characters and whether or not L
has appeared.
Comments