Problem H
Hair of the Dog
Among the many detrimental consequences of alcohol are the unpleasant physiological effects known as a hangover. Typical symptoms of a hangover may include headache, drowsiness, concentration problems, dry mouth, dizziness, fatigue, gastrointestinal distress (e.g., vomiting, diarrhoea), absence of hunger, light sensitivity, depression, sweating, nausea, hyper-excitability, irritability, and anxiety.
A hangover occurs the day after you were drinking.
According to some traditions, hangovers can be cured by alcohol itself. In English, this phenomenon is known as “hair of the dog that bit you,” in other languages as the Cure, a nail pulling another nail, a reparation beer, Konterbier, morning-after-pils, and many other names.
Drinking cancels the hangover that would have occurred from drinking the day before.
Input
On the first line, the number $N$ of consecutive days where you have logged your behaviour. Then follow $N$ lines, one for every day, each containing either “drunk” or “sober.” The first and last entries are “sober.”
Output
The number of days you were hungover.
Sample Input 1 | Sample Output 1 |
---|---|
5 sober drunk drunk sober sober |
1 |
Sample Input 2 | Sample Output 2 |
---|---|
5 sober drunk sober drunk sober |
2 |