Chef and Feedback
All submissions for this problem are available.
Read problems statements in Mandarin Chinese and Russian.
Lots of geeky customers visit our chef's restaurant everyday. So, when asked to fill the feedback form, these customers represent the feedback using a binary string (i.e a string that contains only characters '0' and '1'.Now since chef is not that great in deciphering binary strings, he has decided the following criteria to classify the feedback as Good or Bad :
If the string contains the substring "010" or "101", then the feedback is Good, else it is Bad. Note that, to be Good it is not necessary to have both of them as substring.
So given some binary strings, you need to output whether according to the chef, the strings are Good or Bad.
The first line contains an integer T denoting the number of feedbacks. Each of the next T lines contains a string composed of only '0' and '1'.
For every test case, print in a single line Good or Bad as per the Chef's method of classification.
- 1 ≤ T ≤ 100
- 1 ≤ |S| ≤ 105
Sum of length of all strings in one test file will not exceed 6*106.
Input: 2 11111110 10101010101010
Output: Bad Good
Example case 1.
The string doesn't contain 010 or 101 as substrings.
Example case 2.
The string contains both 010 and 101 as substrings.
|Tags||cakewalk, jan14, programming, viv001|
|Time Limit:||0.5 sec|
|Source Limit:||50000 Bytes|
|Languages:||ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.3.2, CPP 6.3, CPP14, CS2, D, ERL, FORT, FS, GO, HASK, ICK, ICON, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, NODEJS, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYTH, PYTH 3.5, RUBY, SCALA, SCM guile, SCM qobi, ST, TCL, TEXT, WSPC|
Fetching successful submissions
If you are still having problems, see a sample solution here.