#D807. String Compression
String Compression
String Compression
Problem
Given the string S, which consists of lowercase letters and numbers. Follow the steps below to compress the length of string S.
- Change the order of the characters in the character string to any order. Example: "0ig3he12fz99"-> "efghiz012399"
- Perform the following operations any number of times.
- Select a contiguous substring of "abcdefghijklmnopqrstuvwxyz" in the string and replace it with (first character)'-' (last character). Example: "efghiz012399"-> "e-iz012399"
- Select a string with a tolerance of 1 (a continuous substring of "0123456789") in the string and replace it with (first digit)'-' (last digit). Example: "e-iz012399"-> "e-iz0-399"
Find the minimum length of the string obtained by compressing the string S.
Constraints
- 1 ≤ | S | ≤ 100
- String S contains only lowercase letters and numbers
Input
The string S is given on one line.
Output
Output the minimum value of the length of the character string obtained by compressing the character string S on one line. If it cannot be compressed, output the length of the original string S.
Examples
Input
0ig3he12fz99
Output
9
Input
1122334455
Output
6
inputFormat
Input
The string S is given on one line.
outputFormat
Output
Output the minimum value of the length of the character string obtained by compressing the character string S on one line. If it cannot be compressed, output the length of the original string S.
Examples
Input
0ig3he12fz99
Output
9
Input
1122334455
Output
6
样例
0ig3he12fz99
9