Skip to content

Commit 81d2fdb

Browse files
committed
Diagonal Walking
1 parent 959664d commit 81d2fdb

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

954A.cpp

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#include<bits/stdc++.h>
2+
using namespace std;
3+
4+
int main(){
5+
ios_base::sync_with_stdio(false);
6+
cin.tie(NULL);
7+
8+
int n;
9+
cin>>n;
10+
11+
char a[n];
12+
cin>>a;
13+
14+
int seq = 0;
15+
16+
for(int i = 0; i < n - 1; i++){
17+
18+
if(a[i] != a[i+1]){
19+
seq++;
20+
i++;
21+
continue;
22+
}
23+
24+
}
25+
cout<<(n - seq);
26+
}

0 commit comments

Comments
 (0)