Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

Chef and Feedback codechef solution in cpp

#include<iostream>
using namespace std;

int main()
{

	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		string s;
		cin >> s;
		int cnt = 0;
		for (int j = 0; j < s.length(); j++)
		{
			if (s[j] == '0' && s[j + 1] == '1' && s[j + 2] == '0')
				cnt++;
			else if (s[j] == '1' && s[j + 1] == '0' && s[j + 2] == '1')
				cnt++;
		}
		if (cnt >= 1)
			cout << "Good
";
		else
			cout << "Bad
";
		
	}

	return 0;
}
Source by www.codechef.com #
 
PREVIOUS NEXT
Tagged: #Chef #Feedback #codechef #solution #cpp
ADD COMMENT
Topic
Name
8+5 =