[BOJ 11608] Complexity
View as PDF
Submit solution
Assembly, Awk, C, C++, Java, Pascal, Perl, Python, Sed, Text
Points:
1
Time limit:
2.0s
Memory limit:
256M
Problem types
Allowed languages
Define the complexity of a string to be the number of distinct letters in it. For example, the string string has complexity 6 and the string letter has complexity 4.</p>
You like strings which have complexity either 1 or 2. Your friend has given you a string and you want to turn it into a string that you like. You have a magic eraser which will delete one letter from any string. Compute the minimum number of times you will need to use the eraser to turn the string into a string with complexity at most 2.
입력 형식
The input consists of a single line that contains a single string of at most 100 lowercase ASCII letters (‘a’–‘z’).
출력 형식
Print, on a single line, the minimum number of times you need to use the eraser.
예제 입력 1
string
예제 출력 1
4
예제 입력 2
letter
예제 출력 2
2
예제 입력 3
aaaaaa
예제 출력 3
0
예제 입력 4
uncopyrightable
예제 출력 4
13
예제 입력 5
ambidextrously
예제 출력 5
12
예제 입력 6
assesses
예제 출력 6
1
예제 입력 7
assassins
예제 출력 7
2
Comments