Last active
December 31, 2015 04:39
-
-
Save Higgcz/7935140 to your computer and use it in GitHub Desktop.
Count number of different letters in word in array.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inline unsigned calcStates () { | |
unsigned numStates = (unsigned) substrings[0].size() + 1; | |
Word str1, str2; | |
for ( vector<Word>::iterator str = substrings.begin(); (str+1) != substrings.end(); ) { | |
str1 = *str; | |
str2 = *(++str); | |
unsigned i = 0; | |
while (str1[i] == str2[i] && i < str1.size()) i++; | |
numStates += (unsigned) str2.size() - i; | |
} | |
return numStates; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment