output_description: Print the maximum positive integer K that satisfies the condition.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      S
attempt: def get_cache(chars, start, end, cache=dict()):
      pair = (start, end)
      block = cache.get(pair)
      if block is not None:
          return block
      else:
          block = chars[start:end]
          cache[pair] = block
          return block
  
  
  def get_skip(chars, previous_start, previous_end, cache=dict()):
      pair = (previous_start, previous_end)
      if pair in cache:
          return cache[pair]
  
      skip = len(chars)
      previous_len = previous_end - previous_start
      if previous_end + previous_len < len(chars):
          previous = get_cache(chars, previous_start, previous_end)
          suspicious_end = previous_end + previous_len
          suspicious = get_cache(chars, previous_end, previous_end + previous_len)
          if previous == suspicious:
              skip = suspicious_end
      cache[pair] = skip
      return skip
  
  
  def count_k(chars):
      cache = dict()
      stack = []
      previous_start = 0
      previous_end = 0
      max_k = 1
      current = 1
      while True:
          skip = get_skip(chars, previous_start, previous_end)
          while current < len(chars):
              if current == skip:
                  current += 1
                  continue
              pair = (previous_end, current)
              if pair in cache:
                  k = cache[pair]
                  if max_k < k:
                      max_k = k
                  else:
                      current = len(chars)
              else:
                  stack.append((previous_start, previous_end, current, max_k))
                  previous_start = previous_end
                  previous_end = current
                  current = current + 1
                  max_k = 1
                  break
              current += 1
          else:
              if previous_end + 1 != len(chars):
                  max_k += 1
              cache[(previous_start, previous_end)] = max_k
              if len(stack) == 0:
                  break
              _previous_start, _previous_end, _current, _max_k = stack.pop()
              assert _current == previous_end
              assert _previous_end == previous_start
              if _max_k < max_k:
                  _max_k = max_k
  
              previous_start = _previous_start
              previous_end = _previous_end
              current = _current
              max_k = _max_k
  
      return max_k
  
  
  s = input()
  print(count_k(list(s)))
  
problem_description: Statement
  
  Given is a string S consisting of lowercase English letters. Find the maximum
  positive integer K that satisfies the following condition:
  
    * There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \neq S_{i+1} (1 \leq i \leq K-1).
  
  Here S_1S_2...S_K represents the concatenation of S_1,S_2,...,S_K in this
  order.
samples: [{"input": "aabbaa", "output": "4\n    \n\nWe can, for example, divide S into four strings `aa`, `b`, `ba`, and `a`.\n\n* * *"}, {"input": "aaaccacabaababc", "output": "12"}]