STREDUCE - String reduction
English | Tiếng Việt |
Given a string containing only characters of 'a' and 'b'. You can reduce this string by replacing a substring forming a?a or b?b by ?; ? is 'a' or 'b'.
Request
Find a way to minimize the length of given string by reducing it. Output that minimum length.
Input
- A string.
Output
- The minimum length found.
Example
Input:
baaba
Output:
1
Limitations
- The length of the given string does not exceed 300.
hide comments
gawry:
2009-08-20 10:59:49
The input seems to contain some strange white characters, do not use gets. |
|
Seckin Can Sahin:
2009-08-20 10:59:49
in the example,
|
|
ahmed mamdouh [devils13]:
2009-08-20 10:59:49
what is the meaning of
|
|
Carlos Eduardo Rodrigues Alves [USJT]:
2009-08-20 10:59:49
Only one string in the input. Last edit: 2009-06-28 04:03:56 |
|
Karpovych Artem:
2009-08-20 10:59:49
what input should be in this problem?
|
Added by: | AnhDQ |
Date: | 2009-06-26 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ERL JS-RHINO NODEJS PERL6 VB.NET |
Resource: | NEERC 2001 - Western Subregion |