can anyone solve this in c++

There are a row of rooms and a water coolers in a hostel. You are given a string s of length n consisting of letters 'R' and 'W', where each 'R' represents a Room and each 'W' represents a water cooler.
Divide the rooms into sections, where each section has exactly two rooms with any number of water coolers (even 0).
Return the number of ways to divide the rooms. Since the answer may be very large, return it modulo
10^9 + 7. If there is no way, return 0.

Input Format

A string consist of 'R' and 'W'

Constraints

n = string length n<=1e5

Output Format

A single integer denoting number of ways to divide the rooms modulo 10^9+7.

Sample Input 0

RRWWRWR
Sample Output 0

3
Explanation 0

"RRWWRWR"
We can divide the rooms in these three ways.
R R | W W R W R
R R W | W R W R
R R W W | R W R

| denotes divider

Sample Input 1

RWRRWRR
Sample Output 1

0
Explanation 1

As we can't divide five rooms into sets of two, the number of ways will be zero here.

#include <bits/stdc++.h>
using namespace std;

int hostelRoom(string &s){
//solve here
}

int main(){
string s;
cin>>s;
cout<<hostelRoom(s);
}

Comments (1)