/**
Given that:
- 'S' is the String in which we are searching (i.e. 'A')
- 'j' is position of the last char in 'S' included in the Hashing
- 'alpha' is the size of the Alphabet
- 'm' is the size of the string being searched (i.e. 'B_size')

=> Hashing(S, j) = SUMMATION [i=0 -> m-1] { alpha^(m -(i+1)) * char(S[i+j]) }
*/
unsigned long long hash_string(const char* string, unsigned int size) {
    static unsigned int i;
    static unsigned long long hash;

    hash = 0;
    for ( i = 0; i < size; ++i ) {
        hash += hash_char(string, i, size);
    }
    
    return hash;
}
int twice_a_char(char *word) 
{
	struct hash_cell **hash_table = NULL;
	int size = strlen(word);
	if ((hash_table = malloc(sizeof(struct hash_cell*) * size)) != NULL) {//attention au parentheses ici qui sont très importantes!
		for (int i = 0; i< size; i++) {
			int index_i = hash_char(word[i], size);
			if (hash_table[index_i]	== NULL)
				hash_table[index_i] = calloc(1, sizeof(struct hash_cell));	
			if (hash_table[index_i]->val == word[i])
				return 1;
			else
				hash_table[index_i]->val = word[i];		
		}
	} else {
		printf("Allocation Error\n");
	}
	return 0;
}