(RankList for this Question)
You are given a string \(s\) of length \(L\) containing alphabets \(A\) and \(C\). You need to print the count of unique subsequences of \(AC\) in string \(s\). Two subsequences are said to be unique if the indices of either character \(A\) or character \(C\) or both differ.<br>
A subsequence is a sequence that can be derived from the given sequence of string by deleting zero or more characters without changing the order of the remaining elements.
\(2 \leq L \leq 100000\)
String \(s\) contains only characters ‘A’ and ‘C’.
An integer, x, denoting the total number of subsequences of \(AC\) in string \(s\).
If we consider the indexing to be done using 0-based indexing, then the index pairs for ‘A’ and ‘C’ are - (1,2), (1,3), (1,6), (4,6), (5,6).
The index pairs for ‘A’ and ‘C’ are - (1,2), (1,4), (1,6), (1,7), (3,4), (3,6), (3,7), (5,6), (5,7)
Log In to solve the Question