File tree Expand file tree Collapse file tree 1 file changed +64
-0
lines changed Expand file tree Collapse file tree 1 file changed +64
-0
lines changed Original file line number Diff line number Diff line change
1
+ //
2
+ // main.cpp
3
+ // Lecture 37
4
+ //
5
+ // Created by Prince Kumar on 17/04/19.
6
+ // Copyright © 2019 Prince Kumar. All rights reserved.
7
+ //
8
+ // CODE-CHEF
9
+
10
+ // --- ** Problems on Spell bob ** --- //
11
+
12
+
13
+ #include < iostream>
14
+ using namespace std ;
15
+ int main ()
16
+ {
17
+ int T; cin>>T;
18
+ while (T--)
19
+ {
20
+ string s1,s2; cin>>s1>>s2;
21
+ int a[3 ]={0 }; // b count
22
+ for (int i=0 ;i<3 ;i++) // 'b' present or not
23
+ {
24
+ if (s1[i]==' b' || s2[i]==' b' )
25
+ a[i]=1 ;
26
+ }
27
+ int b_count=0 ;
28
+ for (int i=0 ;i<3 ;i++)
29
+ {
30
+ if (a[i]==1 )
31
+ b_count++;
32
+ }
33
+ if (b_count<=1 )
34
+ cout<<" no" <<endl;
35
+ else if (b_count==2 )
36
+ {
37
+ int index=0 ;
38
+ for (int i=0 ;i<3 ;i++)
39
+ {
40
+ if (a[i]==0 )
41
+ index=i;
42
+ }
43
+ if (s1[index]==' o' || s2[index]==' o' )
44
+ cout<<" yes" <<endl;
45
+ else
46
+ cout<<" no" <<endl;
47
+ }
48
+ else if (b_count==3 )
49
+ {
50
+ int o_count=0 ;
51
+ for (int i=0 ;i<3 ;i++)
52
+ {
53
+ if (s1[i]==' o' || s2[i]==' o' )
54
+ o_count++;
55
+ }
56
+ if (o_count==0 )
57
+ cout<<" no" <<endl;
58
+ else
59
+ cout<<" yes" <<endl;
60
+ }
61
+ }
62
+ }
63
+
64
+
You can’t perform that action at this time.
0 commit comments