Skip to content

Commit

Permalink
Add 16787.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiyabye committed Jul 5, 2024
1 parent 065adc6 commit 984787b
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions 16xxx/16787.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include <iostream>
#include <string>
using namespace std;

void solve(void) {
int n; cin >> n;
string s; cin >> s;

int ans = 0;
for (int i=1; i<n; i++) {
if (s[i] != s[i-1]) {
ans++; i++;
}
}
cout << ans;
}

int main(void) {
ios::sync_with_stdio(false);
cin.tie(nullptr);

solve();
return 0;
}

0 comments on commit 984787b

Please sign in to comment.