Computer Science, asked by rahuldas8938, 10 months ago

Given a pixel sequence consisting of red, green and blue pixels find the count of all contiguous subsequences such that each subsequence has a minimum length of 3 and the sequence cycles between red r, green g and blue b. For eg. if the sequence starts with g then the next character in the sequence should be b and the next should be r and so on. Input Format First line of test case consists of an integer t denoting the number of test cases. Next t test cases follow. Each test case consists of two lines. First line of each test case is the length of the pixel sequence. Second line is the pixel sequence. Sample Input 5 3 rgb 4 brgb 2 rg 1 b 16 rgbrbbrgbgbrgrgb Sample Output 1 3 0 0 10 Constraints 1 <= t <= 1000 1 <= |s| <= 1000 character set of s - rgb Explanation For the character sequence rgbrbbrgbgbrgrgb, there are 10 possible contiguous subsequences viz. rgb, rgbr, gbr, brg, brgb, rgb, gbr, gbrg, brg, rgb which satisfy the condition. (need to write c# code for the above question )

Answers

Answered by bindusingh05
0

Answer:

ask this big answer to Google

Answered by rathan4all
0

Answer:

Answered here

https://brainly.in/question/13305062

Similar questions