AtCoder Grand Contest 037
A
Dividing a String
AtCoder
⌀ 232
原题
←B →
翻译中…

Problem 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.

翻译中…

Constraints

翻译中…
  • $1 \leq |S| \leq 2 \times 10^5$
  • $S$ consists of lowercase English letters.
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

S

翻译中…

Output

翻译中…

Print the maximum positive integer $K$ that satisfies the condition.

翻译中…

样例

Input #1
aabbaa
Output #1
4
We can, for example, divide $S$ into four strings `aa`, `b`, `ba`, and `a`.
Input #2
aaaccacabaababc
Output #2
12
题目信息
题号
agc037_a
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。