Click Here to go back to the homepage.

Peragrams Solution:


import java.util.*;

public class Kattis {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    char [] arr = sc.nextLine().toCharArray();
    HashMap<Character, Integer> hm = new HashMap<>();
    for(char c: arr){
      if(hm.containsKey(c)){
        hm.replace(c, hm.get(c)+1);
      }
      else{
        hm.put(c, 1);
      }
    }
    Collection<Integer> values = hm.values();
    int i = -1;
    for(Integer foo : values){
      i = foo % 2 == 0? i:i+1;
    }
    if(i <= 0){
      System.out.println(0);
    }
    else {
      System.out.println(i);
    }
  }
}