-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDay_064.cpp
33 lines (27 loc) · 1.07 KB
/
Day_064.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/**
*Problem Statement: Amit and Feedback: Lots of geeky customers visit our Amit'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 Amit 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 Amit,
the strings are Good or Bad.
*Author: Kunal Kathpal (https://github.com/kunal-2002)
*/
#include <bits/stdc++.h>
using namespace std;
int main(){
cout<<"Enter number of test cases:\t";
int T;
cin>>T;
while(T--){
string s;cin>>s;
bool found=false;
if(s.find("101")!=string::npos||s.find("010")!=string::npos ){
found=true;
}
cout<<(found ? "Good":"Bad");
cout<<endl;
}
return 0;
}