Language: C++

#include <bits/stdc++.h>

using ll = long long;
#define int long long

namespace ext {
	template <class t>
	struct vec_type;
	template <class t>
	constexpr bool is_vec_v;
	using namespace std;
	template<class t>
	struct vector : std::vector<t> {
		using std::vector<t>::vector;
		char dil = ' ';
		vector<t> accum() {
			vector<t> res(this->size() + 1);
			for (size_t i = 0; i < this->size(); i++) {
				res[i+1] = (*this)[i] + res[i];
			}
			return res;
		}
		template<class u = t>
		typename enable_if<is_vec_v<u>, vector<t>>::type accum2d() {
			const size_t h = this->size();
			const size_t w = (*this)[0].size();
			using s = typename vec_type<u>::type;
			vector<t> res(h + 1, vector
(w + 1));
			for (size_t i = 0; i < h; i++) {
				for (size_t j = 0; j < w; j++) {
					res[i+1][j+1] = (*this)[i][j];
					res[i+1][j+1] += res[i][j+1];
					res[i+1][j+1] += res[i+1][j];
					res[i+1][j+1] -= res[i][j];
				}
			}
			return res;
		}
		vector<t> zaatsu() {
			map<t, int> m;
			for (auto& e: *this) m[e] = 1;
			int count = 0;
			for (auto& e: m) e.second = count++;
			vector<t> res = *this;
			for (auto& e: res) e = m[e];
			return res;
		}
		friend istream& operator>>(istream& is, vector<t>& t) {
			for (auto& e: t) cin >> e;
			return is;
		}
		friend ostream& operator<<(ostream& os, vector<t>& t) {
			t.print(' ', os);
			return os;
		}
		void print(char del = ' ', ostream& os = cout) {
			for (size_t i = 0; i < this->size(); i++) {
				os << (*this)[i];
				if (i + 1 != this->size()) os << del;
				os.flush();
			}
		}
		void println(char del = ' ', ostream& os = cout) {
			print(del, os);
			cout << endl;
		}
		long long crossing_merge() {
			auto t = *this;
			return t.crossing_merge_sub();
		}
		// [min_v, max_v)
		long long crossing_bit(t min_v = -1, t max_v = -1) {
			if (min_v == -1) min_v = this->min();
			if (max_v == -1) max_v = this->max() + 1;
			vector<t> bit(max_v - min_v + 1, 0);
			long long res = 0;
			for (auto e: *this) {
				e = max_v - e;
				for (size_t x = e - 1; x; x -= x & -x) {
					res += bit[x];
				}
				for (size_t x = e; x < bit.size() ; x += x & -x) {
					bit[x]++;
				}
			}
			return res;
		}
		bool permutation() {
			return next_permutation(this->begin(), this->end());
		}
		t& max() {
			return *max_element(this->begin(), this->end());
		}
		t& min() {
			return *min_element(this->begin(), this->end());
		}
private:
		long long crossing_merge_sub() {
			if (this->size() == 1) return 0;
			int x = this->size() / 2;
			vector<t> left(this->begin(), this->begin() + x);
			vector<t> right(this->begin() + x, this->end());
			long long res = left.crossing_merge_sub() + right.crossing_merge_sub();
			left.push_back(numeric_limits<t>::max()); right.push_back(numeric_limits<t>::max());
			size_t l = 0, r = 0;
			while (l + r < this->size()) {
				if (left[l] < right[r]) {
					(*this)[l+r] = left[l];
					l++;
				} else {
					(*this)[l+r] = right[r];
					r++;
					res += x - l;
				}
			}
			return res;
		}
	};
	template <class t>
	struct vec_type : std::false_type {};
	template <class t>
	struct vec_type<vector<t>> : std::true_type {
		using type = t;
	};
	template <class t>
	constexpr bool is_vec_v = vec_type<t>::value;
}

// [a -> b-1]
#define reps(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
// [0 -> a-1]
#define rep(i, a) reps(i, 0, (a))
// [a-1 -> b]
#define rreps(i, a, b) for (int i = (int)((a)-1); i >= (int)(b); i--)
// [a-1 -> 0]
#define rrep(i, a) rreps(i, a, 0)
#define all(v) (v).begin(), (v).end()
// next_permutation(all(v))
#define perm(v) next_permutation(all(v))
/*sort(all(v));
 * (v).erase(unique(all(v)), v.end())*/
#define unique(v)\
	sort(all(v));\
	(v).erase(unique(all(v)), v.end())
#define minv(v) min_element(all(v))
#define maxv(v) max_element(all(v))
#define min3(a, b, c) min(min(a, b), c)
#define min4(a, b, c, d) min(min3(a, b, c), d)
#define min5(a, b, c, d, e) min(min4(a, b, c, d), e)
#define min6(a, b, c, d, e, f) min(min5(a, b, c, d, e), f)
#define max3(a, b, c) max(max(a, b), c)
#define max4(a, b, c, d) max(max3(a, b, c), d)
#define max5(a, b, c, d, e) max(max4(a, b, c, d), e)
#define max6(a, b, c, d, e, f) max(max5(a, b, c, d, e), f)
// b is [a, c)
#define range(a, b, c) ((a) <= (b) && (b) < (c))
// c is [a, e) && d is [b, f)
#define range2d(a, b, c, d, e, f) (range((a), (c), (e)) && range((b), (d), (f)))
#define chmin(a, b) a = min(a, (b))
#define chmin3(a, b, c) a = min3(a, (b), (c))
#define chmin4(a, b, c, d) a = min4(a, (b), (c), (d))
#define chmin5(a, b, c, d, e) a = min5(a, (b), (c), (d), (e))
#define chmin6(a, b, c, d, e, f) a = min6(a, (b), (c), (d), (e), (f))
#define chmax(a, b) a = max(a, (b))
#define chmax3(a, b, c) a = max3(a, (b), (c))
#define chmax4(a, b, c, d) a = max4(a, (b), (c), (d))
#define chmax5(a, b, c, d, e) a = max5(a, (b), (c), (d), (e))
#define chmax6(a, b, c, d, e, f) a = max6(a, (b), (c), (d), (e), (f))
#define fcout cout << fixed << setprecision(15)
#define yes(f) cout << ((f) ? yes_str : no_str) << endl;

using namespace std;
using namespace ext;

int dfs(const vector<vector<int>>& g, vector<int>& v, int p) {
	if (p < 0) {
		if (v.size() < 2) return v.size();
		rep(i, v.size()-1) {
			reps(j, i+1, v.size()) {
				if (g[v[i]][v[j]] == 0) return 0;
			}
		}
		return v.size();
	} else {
		int res = dfs(g, v, p-1);
		v.push_back(p);
		chmax(res, dfs(g, v, p-1));
		v.pop_back();
		return res;
	}
}

#define cin input
#define cout output

void solve(istream& input, ostream& output) {
	string s; cin >> s;
	int cnt = 0;
	string pre = "";
	string now = "";
	rep(i, s.size()) {
		now += s[i];
		if (pre != now) {
			cnt++;
			pre = now;
			now = "";
		}
	}
	cout << cnt << endl;
}

#undef cin
#undef cout

#ifndef check_cpp

signed main() {
	solve(cin, cout);
}

#endif


Compiler output:
a.cc:48:68: error: declaration of 'ext::vector<t>& t' shadows template parameter
   48 |                 friend istream& operator>>(istream& is, vector<t>& t) {
      |                                                         ~~~~~~~~~~~^
a.cc:12:18: note: template parameter 't' declared here
   12 |         template<class t>
      |                  ^~~~~
a.cc:52:68: error: declaration of 'ext::vector<t>& t' shadows template parameter
   52 |                 friend ostream& operator<<(ostream& os, vector<t>& t) {
      |                                                         ~~~~~~~~~~~^
a.cc:12:18: note: template parameter 't' declared here
   12 |         template<class t>
      |                  ^~~~~
a.cc: In function 'std::istream& ext::operator>>(std::istream&, vector<t>&)':
a.cc:48:68: error: declaration of 'ext::vector<t>& t' shadows template parameter
   48 |                 friend istream& operator>>(istream& is, vector<t>& t) {
      |                                                         ~~~~~~~~~~~^
a.cc:12:18: note: template parameter 't' declared here
   12 |         template<class t>
      |                  ^~~~~
a.cc: In function 'std::ostream& ext::operator<<(std::ostream&, vector<t>&)':
a.cc:52:68: error: declaration of 'ext::vector<t>& t' shadows template parameter
   52 |                 friend ostream& operator<<(ostream& os, vector<t>& t) {
      |                                                         ~~~~~~~~~~~^
a.cc:12:18: note: template parameter 't' declared here
   12 |         template<class t>
      |                  ^~~~~
a.cc: In member function 'long long int ext::vector<t>::crossing_merge()':
a.cc:68:30: error: declaration of 'auto t' shadows template parameter
   68 |                         auto t = *this;
      |                              ^
a.cc:12:18: note: template parameter 't' declared here
   12 |         template<class t>
      |                  ^~~~~
a.cc: At global scope:
a.cc:126:24: error: redefinition of 'template<class t> constexpr const bool ext::is_vec_v'
  126 |         constexpr bool is_vec_v = vec_type<t>::value;
      |                        ^~~~~~~~
a.cc:10:24: note: 'template<class t> constexpr const bool ext::is_vec_v<t>' previously declared here
   10 |         constexpr bool is_vec_v;
      |                        ^~~~~~~~
a.cc:175:15: error: reference to 'vector' is ambiguous
  175 | int dfs(const vector<vector<int>>& g, vector<int>& v, int p) {
      |               ^~~~~~
a.cc:13:16: note: candidates are: 'template<class t> struct ext::vector'
   13 |         struct vector : std::vector<t> {
      |                ^~~~~~
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:428:11: note:                 'template<class _Tp, class _Alloc> class std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
a.cc:175:21: error: expected ',' or '...' before '<' token
  175 | int dfs(const vector<vector<int>>& g, vector<int>& v, int p) {
      |                     ^
a.cc: In function 'long long int dfs(int)':
a.cc:176:13: error: 'p' was not declared in this scope
  176 |         if (p < 0) {
      |             ^
a.cc:177:21: error: 'v' was not declared in this scope
  177 |                 if (v.size() < 2) return v.size();
      |                     ^
a.cc:178:24: error: 'v' was not declared in this scope
  178 |                 rep(i, v.size()-1) {
      |                        ^
a.cc:130:56: note: in definition of macro 'reps'
  130 | #define reps(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
      |                                                        ^
a.cc:178:17: note: in expansion of macro 'rep'
  178 |                 rep(i, v.size()-1) {
      |                 ^~~
a.cc:180:37: error: 'g' was not declared in this scope
  180 |                                 if (g[v[i]][v[j]] == 0) return 0;
      |                                     ^
a.cc:183:24: error: 'v' was not declared in this scope
  183 |                 return v.size();
      |                        ^
a.cc:185:31: error: 'g' was not declared in this scope
  185 |                 int res = dfs(g, v, p-1);
      |                               ^
a.cc:185:34: error: 'v' was not declared in this scope
  185 |                 int res = dfs(g, v, p-1);
      |                                  ^