프로그램 명: ncpc_death
제한시간: 1 초

WoW Arthasdk는 간혹 Death Grip을 써야 할 타이밍에 실수로 Chains of Ice를 쓴다고 합니다.

문제에서는 Chains of Ice를 쓰고 바로 이어서 Death Grip 을 쓴 경우를 전부 "죽음의 기사가 Death Grip을 써야 했는데 실수로 Chains of Ice를 썼고, 그 실수를 깨닫고 바로 Death Grip을 다시 쓴 상황"으로 간주해서, 그 실수로 인해 대결에서 지게 된다고 했습니다. 따라서 이 조건에 맞게 대결에서 이기는 경우와 지는 경우를 구분해서 풀면 됩니다.


There once was a champion of WoW Arthasdk the name he was bestowed He Death Gripped you to his side His Chains of Ice stopped your stride And Obliterates made you say "OWW!"

But one day our hero got puzzled His Death Grip totally fizzled In his darkest despair He could barely hear "OMG NOOB u Chains of Iced than u Death Gripped"

입력

You are given a recording of the abilities our hero used in his battles.

The first line of input will contain a single integer n (1 <= n <= 100), the number of battles our hero played.

Then follow n lines each with a sequence of ki (1 <= ki <= 1000) characters, each of which are either 'C', 'D' or 'O'. These denote the sequence of abilities used by our hero in the i-th battle. 'C' is Chains of Ice, 'D' is Death Grip and 'O' is Obliterate.

출력

Output the number of battles our hero won, assuming he won each battle where he did not Chains of Ice immediately followed by Death Grip.

입출력 예

입력

3
DCOOO
DODOCD
COD

출력

2
출처: The 2011 Nordic Collegiate Programming Contest problem C
번역: jhp109

[질/답] [제출 현황] [푼 후(1)]
[ 채 점 ] [홈으로]  [뒤 로]