I came up with this and it seems to work pretty good but the problem i am having as far as i can see is that i have to take account not only for duplicate characters but for multiple characters (3 or more) I tried this out on words like Kaaat (not that this is a word) and the results are off. And also i have to figure out how to take into account if the multiple characters are seperated. for instance. Kaata. Right now all i am doing is subtracting 2 which takes care of the original and the duplicate.
Any ideas?
Code:for(int index = 0; index <= key.length() - 2; ++index){ matchingchar = key.charAt(index); x = (((key.length() - 2) + (key.length() * (key.length() - 2))) - index); while((q = x % key.length()) != 0){ if(key.charAt(z) == matchingchar){ duplicates =+ 2; } --x; ++z; } z =+ 1; } int nonduplicatechars = (key.length() - duplicates);




Reply With Quote