Question: Red, Green and Blue Given a pixel sequence consisting of red, green and blue pixels find the count of all contiguous subsequences such that

Red, Green and Blue Given a pixel sequence consisting of red, green and blue pixels find the count of all contiguous subseque

Red, Green and Blue 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 S&W 0 0 10

Step by Step Solution

3.49 Rating (166 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

import javautilScanner public class PixelAnalyzer public static void m... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!

Related Book