File tree Expand file tree Collapse file tree 1 file changed +69
-0
lines changed Expand file tree Collapse file tree 1 file changed +69
-0
lines changed Original file line number Diff line number Diff line change
1
+ #include < bits/stdc++.h>
2
+ using namespace std ;
3
+
4
+ // Code Written By: Vikash Patel
5
+
6
+ int emptySeat (string x)
7
+ {
8
+ if (x.substr (0 ,2 )== " OO" )
9
+ {
10
+ return -1 ;
11
+ }
12
+ else if (x.substr (3 ,2 )==" OO" )
13
+ {
14
+ return 1 ;
15
+ }
16
+ else
17
+ {
18
+ return 0 ;
19
+ }
20
+ }
21
+
22
+ int main ()
23
+ {
24
+ int n;
25
+ cin>>n;
26
+ string s[n];
27
+ for (int i=0 ;i<n;i++)
28
+ {
29
+ cin>>s[i];
30
+ }
31
+
32
+ bool empty=false ;
33
+ for (int i=0 ;i<n;i++)
34
+ {
35
+ if (emptySeat (s[i])==-1 )
36
+ {
37
+ empty=true ;
38
+ s[i].replace (0 ,2 ," ++" );
39
+ break ;
40
+ }
41
+ else if (emptySeat (s[i])==1 )
42
+ {
43
+ empty=true ;
44
+ s[i].replace (3 ,2 ," ++" );
45
+ break ;
46
+ }
47
+ }
48
+ if (empty)
49
+ {
50
+ cout<<" YES" <<endl;
51
+ for (int i=0 ;i<n;i++)
52
+ {
53
+ cout<<s[i]<<endl;
54
+ }
55
+ }
56
+ else
57
+ {
58
+ cout<<" NO" <<endl;
59
+ }
60
+
61
+ }
62
+
63
+
64
+
65
+
66
+
67
+
68
+
69
+
You can’t perform that action at this time.
0 commit comments