Rock is rock too
InterviewTime limit2sMemory limit512 MB
Count the subsequences of a string of up to 1,000,000 uppercase letters that spell ROCK, modulo 1e9+7.
- Level
Easy3 of 10
- Topics
- Dynamic programming, String
- Solved
- No attempts yet
Problem
나락도 락이다. 부모님께 온 연락도 락이다. 오락가락?도 락? 이다.?
Given a string of length made of uppercase English letters, count its subsequences that end with ROCK. Print the count modulo .
Input
The first line contains the length of the string .
The second line contains the string , made of uppercase English letters only.
Output
Print the number of subsequences of that end with ROCK, modulo .
Hint
A subsequence of a string is a string obtained by deleting some characters from it. Deleting no characters is also allowed. For example, aan is a subsequence of hanyang.