You are looking for a way to calculate the number of repeated characters.. or squence of characters appear in a given string. This is how I would do it:

First.. I would calculate the total number of possiblities.. which is the, "total number of characters.. to the total number of characters power."

Code:

int total_possibilities = pow(strlen(input), strlen(input));

*you can use this information to make dynamic arrays and use as a loop counter*

The next step, would be to populate a string array with every single possible character combination. This algorithm might seem wicked hard at first.. but if you start out with like a 4 or 5 letter word.. and draw it out on paper.. you can come up with a general algortihm that will work pretty easily.

The next step, would be to create an array of counters the same size as your array of possible character combinations. You will use this array in a direct 1-to-1 correlation with your array of possible character combinations. (i.e. the 3rd element counter will match up with the 3rd element of your character possibility array.. so you can determine stuff like 'GT' was matched 10 times etc. )

The next step, would be to use nested for loops.. to run through the user input array.. and compare the user input.. against every posibility. If there is a match you can increment the corrosponding counter.

*maybe something like this:*
Code:

string test = "";
for(int i=0; i<strlen(input); i++)
{
test+=input[i]; //slowly build up a "test" string, one character at a time
for(int j=0; j<total_possibilities; j++)
{
if(test == possibilities[j])
++counters[j]; //notice the 1:1 correlation
}
}

This is probably nothing like your mismatch approach to solving this problem.. but I hope it offers a different perspective.