Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <algorithm>
- #include <bits/stdc++.h>
- using namespace std ;
- typedef long long ll ;
- void ABDEL3AL () {
- ios_base::sync_with_stdio(false) , cin.tie(nullptr) , cout.tie(nullptr) ;
- #ifndef ONLINE_JUDGE
- freopen("input.txt" , "r" ,stdin) , freopen("output.txt" , "w" , stdout) ;
- #endif
- }
- int main() {
- ABDEL3AL() ;
- int n , curr = 1 ;
- cin >> n ;
- string s;
- cin >> s ;
- for (int i = 1; i < s.size(); i++)
- if (s[i] != s[i - 1]) curr++ ;
- else curr++ ;
- cout << curr << "\n" ;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment