coordinating, we can observe the number of times some white string meets some dark string. We process the number of sets of distinctively shaded strings that cross rather than the number of convergence focuses, so one convergence point might be counted on numerous occasions if various sets of strings meet at a similar point. In case c is a legitimate shading, let f(c) mean the base number of such convergences out
Correct answer will be upvoted else Multiple Downvoted. Don't submit random answer. Computer science.
coordinating, we can observe the number of times some white string meets some dark string. We process the number of sets of distinctively shaded strings that cross rather than the number of convergence focuses, so one convergence point might be counted on numerous occasions if various sets of strings meet at a similar point. In case c is a legitimate shading, let f(c) mean the base number of such convergences out of all conceivable matchings.
circle above is portrayed by the shading bwbbbwww. In the wake of coordinating with the spools as displayed, there is one convergence between contrastingly shaded strings. It tends to be demonstrated that it is the base conceivable, so f(bwbbbwww)=1.
You are given a string s addressing an incomplete shading, with dark, white, and uncolored spools. A shading c is called s-reachable if you can accomplish it by allocating tones to the uncolored spools of s without changing the others.
A shading c is picked consistently at arbitrary among all substantial, s-reachable colorings. Process the normal worth of f(c). You should track down it by modulo 998244353.
We can show that the appropriate response can be written in the structure pq where p and q are moderately prime integers and q≢0(mod998244353). The appropriate response by modulo 998244353 is equivalent to (p⋅q−1) modulo 998244353.
Input
The principal line contains two integers n, m (2≤n≤2⋅105, n is even, m=0) — the number of spools and updates, individually. There are no updates in the simple variant, so it is consistently 0.
The subsequent line contains a string s of length n — the incomplete shading of the spools. The I-th character will be 'w', 'b', or '?', depicting if the I-th spool is white, dark, or uncolored, separately.
It is ensured there exists no less than one uncolored spool.
Output
Print the normal worth of f(c) by modulo 998244353.
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 1 images