Problem:
Score : 700 points

Problem Statement

We have a string s consisting of lowercase English letters.
Snuke is partitioning s into some number of non-empty substrings.
Let the subtrings obtained be s_1, s_2, ..., s_N from left to right. (Here, s = s_1 + s_2 + ... + s_N holds.)
Snuke wants to satisfy the following condition:

For each i (1 \leq i \leq N), it is possible to permute the characters in s_i and obtain a palindrome.

Find the minimum possible value of N when the partition satisfies the condition.

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 minimum possible value of N when the partition satisfies the condition.

Sample Input 1

aabxyyzz

Sample Output 1

2

The solution is to partition s as aabxyyzz = aab + xyyzz.
Here, aab can be permuted to form a palindrome aba, and xyyzz can be permuted to form a palindrome zyxyz.

Sample Input 2

byebye

Sample Output 2

1

byebye can be permuted to form a palindrome byeeyb.

Sample Input 3

abcdefghijklmnopqrstuvwxyz

Sample Output 3

26

Sample Input 4

abcabcxabcx

Sample Output 4

3

The solution is to partition s as abcabcxabcx = a + b + cabcxabcx.

Solution in Java8 (OpenJDK 1.8.0) (judge verdict: Accepted)

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Map;
import java.util.Scanner;
import java.util.HashMap;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author ZYCSwing
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskD {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String s = in.next();
            int n = s.length();
            int[] dp = new int[n + 1];
            dp[0] = 0;
            for (int i = 0; i < s.length(); ++i) {
                dp[i + 1] = dp[i] ^ (1 << (s.charAt(i) - 'a'));
            }
            Map<Integer, Integer> map = new HashMap<>();
            map.put(0, 0);
            int[] resdp = new int[n + 1];
            Arrays.fill(resdp, Integer.MAX_VALUE);
            resdp[0] = 0;
            for (int i = 0; i < n; ++i) {
                if (map.containsKey(dp[i + 1])) {
                    resdp[i + 1] = map.get(dp[i + 1]) + 1;
                }
                int mask;
                for (int j = 0; j < 26; ++j) {
                    mask = dp[i + 1] ^ (1 << j);
                    if (map.containsKey(mask)) {
                        resdp[i + 1] = Math.min(resdp[i + 1], map.get(mask) + 1);
                    }
                }
                if (map.containsKey(dp[i + 1])) {
                    map.put(dp[i + 1], Math.min(map.get(dp[i + 1]), resdp[i + 1]));
                } else {
                    map.put(dp[i + 1], resdp[i + 1]);
                }
            }

            out.println(resdp[n]);
        }

    }
}