#include <bits/stdc++.h>
using namespace std;
struct Trie{
struct node{
int cnt;
node* ch[26];
node() : cnt(0){
for(int j = 0; j < 26; j++) ch[j] = NULL;
}
};
void insert(string& s, int pos, node* root){
if(pos == s.length()) {
root -> cnt ++;
return;
int cur = s[pos] - 'A';
if(root -> ch[cur] == NULL) root -> ch[cur] = new node();
insert(s, pos+1, root -> ch[cur]);
void insert(string& s){
insert(s, 0, root);
void query(node* root, int& ans, int len){
if(!root) return;
int cur = root -> cnt;
for(int j = 0; j < 26; j++)
if(root -> ch[j]){
if(root -> ch[j] -> cnt % 2 != 0 && root -> ch[j] -> cnt < 2) cur++;
cur -= root -> ch[j] -> cnt;
g++
Case #1: 4