A - Dividing a String
Editorial
/


Time Limit: 2 sec / Memory Limit: 1024 MB
配点 : 点
問題文
英小文字からなる文字列 が与えられます。以下の条件をみたす最大の正整数 を求めてください。
- の空でない 個の文字列への分割 であって () を満たすものが存在する。
ただし、 をこの順に連結して得られる文字列のことを によって表しています。
制約
- は英小文字からなる
入力
入力は以下の形式で標準入力から与えられる。
出力
条件をみたす最大の正整数 を出力せよ。
入力例 1Copy
Copy
aabbaa
出力例 1Copy
Copy
4
例えば aa
,b
,ba
,a
と を つの文字列に分割することができます。
入力例 2Copy
Copy
aaaccacabaababc
出力例 2Copy
Copy
12
Score : points
Problem Statement
Given is a string consisting of lowercase English letters. Find the maximum positive integer that satisfies the following condition:
- There exists a partition of into non-empty strings such that ().
Here represents the concatenation of in this order.
Constraints
- consists of lowercase English letters.
Input
Input is given from Standard Input in the following format:
Output
Print the maximum positive integer that satisfies the condition.
Sample Input 1Copy
Copy
aabbaa
Sample Output 1Copy
Copy
4
We can, for example, divide into four strings aa
, b
, ba
, and a
.
Sample Input 2Copy
Copy
aaaccacabaababc
Sample Output 2Copy
Copy
12