Kino
의견: 0
\(4^{th}\) round, February \(18^{th}\), 2012
New theater just opened in Mirko’s home town, and Mirko and Slavko naturally went to check it out.
Opening projection was filled to the last place, and Mirko got mad because c\(up-ho\)lders at both sides of
his seat were taken and he had nowhere to put his Coke.
A row in theater has N seats. There is a single c\(up-ho\)lder between adjacent seats, and also two
additional c\(up-ho\)lders at both ends of the row. Exception to this are pairs of love sea\(ts - th\)ere is no
c\(up-ho\)lder between them.
Your task is to help Mirko. Given sequence of letters describing seats in some row, and assuming that
all seats are taken, find the maximum number of people that can put their cups in a c\(up-ho\)lder right
next to their seat.
Letter ‘S’ in the sequence denotes ordinary seat, and ‘L’ denotes love seat. Love seats will always come
in pairs of adjacent seats.
Diagram below corresponds to sequence ‘SLLLLSSLL’, with asterixes denoting c\(up-ho\)lders.
* \(S * L\) \(L * L\) \(L * S * S * L\) L *
For this example, at least two persons won’t be able to put their cups into c\(up-ho\)lders.
The first line of input contains the integer N (\(1 \le N \le 50\)), number of seats in a row.
The following line contains a sequence of N letters ‘L’ or ‘S’, describing the row as stated above.
The first and only line of output should contain the maximum number of people that can put their
cups in c\(up-ho\)lder right next to them.
3
SSS34
SLLS49
SLLLLSSLL7평가 및 의견
Kino
Log in to rate problems.
아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.
풀이 제출
Kino