Yingchi is practicing tennis for an upcoming tournament. Since he is particularly bad at serving, he decides to focus on his serving technique!
During his practice session, Yingchi serves times. Each serve results in
different outcomes:
S
: a successful serve worthpoint
P
: a perfect serve worthpoints
F
: a failed serve worth no points
However, Yingchi, like us, is human and gets nervous under pressure!
- After making a perfect serve, Yingchi's next serve cannot be perfect
- After making
consecutive successful or perfect serves, Yingchi's next serve will be a failed serve.
He records his practice session on a piece of paper, but it gets mixed up with someone else's practice logs! Yingchi looks to you to help him determine which practice logs could possibly be his.
Constraints
Input Specification
The first line will contain two integers, and
.
The second line will contain a string of length consisting of only
S
, P
, and F
, denoting the practice log.
Output Specification
If the practice log is possibly Yingchi's, output YES
followed by the score of the practice session.
If it could not possibly be Yingchi's, output NO
.
Sample Input 1
8 2
SSFSPFSF
Sample Output 1
YES
6
Explanation for Sample 1
There are no segments of consecutive S
or P
with length greater than , so it is valid. Then, there are
successful serves (worth
points) and
perfect serve (worth
points), for a total of
points.
Sample Input 2
6 2
SPSPSP
Sample Output 2
NO
Comments