We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b3bf97d commit 1af6c5eCopy full SHA for 1af6c5e
721A - One-dimensional Japanese Crossword.cpp
@@ -0,0 +1,46 @@
1
+#include<bits/stdc++.h>
2
+using namespace std;
3
+
4
+// Code Written By: Vikash Patel
5
6
+int main()
7
+{
8
+ int n;
9
+ cin>>n;
10
+ string s;
11
+ cin>>s;
12
+ int c=0;
13
+ int d=0;
14
+ vector<int> ans;
15
+ for(int i=0;i<n;i++)
16
+ {
17
+ if(s[i]=='B')
18
19
+ c++;
20
+ d=0;
21
+ for(int j=i;j<n;j++)
22
23
+ if(s[j]=='B')
24
+ d++;
25
+ else
26
+ break;
27
+ }
28
+ i+=d;
29
+ ans.push_back(d);
30
31
32
+ cout<<c<<endl;
33
+ for(auto i : ans)
34
35
+ cout<<i<<" ";
36
37
+ cout<<endl;
38
+}
39
40
41
42
43
44
45
46
0 commit comments