#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 1000000;
void printVec(std::vector<int>& vec) {
  std::cout << "";
  for (auto it = vec.begin(); it != vec.end(); ++it) {
    std::cout << *it << " ";
  }
  std::cout << std::endl;
}
void printVec1(std::vector<string>& vec) {
  std::cout << "";
  for (auto it = vec.begin(); it != vec.end(); ++it) {
    std::cout << *it << " ";
  }
  std::cout << std::endl;
}
void printVec2(std::vector<int64_t>& vec) {
  std::cout << "";
  for (auto it = vec.begin(); it != vec.end(); ++it) {
    std::cout << *it << " ";
  }
  std::cout << std::endl;
}
int64_t gcd(int64_t a, int64_t b) { return b != 0 ? gcd(b, a % b) : a; }
int64_t lcm(int64_t a, int64_t b) { return a / gcd(a, b) * b; }
bool integer(double num) { return floor(num) == num; }
int64_t fact(int num) {
  if (num == 0)
    return 1;
  else
    return num * fact(num - 1);
}
int n, m;
char field[100][100];
void dfs(int x, int y) {
  field[x][y] = '.';
  for (int dx = -1; dx <= 1; dx++) {
    for (int dy = -1; dy <= 1; dy++) {
      int nx = x + dx, ny = y + dy;
      if (0 <= nx && nx < n && 0 <= ny && ny < m && field[nx][ny] == 'W') {
        dfs(nx, ny);
      }
    }
  }
  return;
}
int main() {
  string str;
  cin >> str;
  string temp;
  int cnt1 = 0, cnt2 = 0;
  int pos = 0;
  string t = "";
  int j;
  for (int i = 0; i < str.size(); i++) {
    for (int k = 1; k < 200001; k++) {
      if (k + pos <= str.size() && pos < str.size()) t = str.substr(pos, k);
      if (t != temp) {
        cnt1++;
        temp = t;
        pos = pos + k;
        break;
      }
    }
  }
  reverse(str.begin(), str.end());
  pos = 0;
  t = "";
  for (int i = 0; i < str.size(); i++) {
    for (int k = 1; k < 200001; k++) {
      if (k + pos <= str.size() && pos < str.size()) t = str.substr(pos, k);
      if (t != temp) {
        cnt2++;
        temp = t;
        pos = pos + k;
        break;
      }
    }
  }
  cout << max(cnt1, cnt2);
  cout << endl;
  return 0;
}
