Skip to content

Instantly share code, notes, and snippets.

@ateruimashin
Created May 28, 2020 21:49
Show Gist options
  • Save ateruimashin/8f184d456f3873607cf47d261c7517dc to your computer and use it in GitHub Desktop.
Save ateruimashin/8f184d456f3873607cf47d261c7517dc to your computer and use it in GitHub Desktop.
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i,s,n) for(int i = (s); i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main(){
string s;
cin >> s;
string last = "", now = "";
int ans = 0;
for(auto c : s) {
now += c;
if(now==last)
continue;
last = now;
now = "";
ans++;
}
cout << ans << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment