int LOOPS_RUN = 0, MISMATCHES_FOUND = 0, LENGTH_OF_WORDS = word1.length(); // assumes their the same.. not sure if thats true or not.
while(LOOPS_RUN < LENGTH_OF_WORDS)
{
if(word1.charAt(LOOPS_RUN) == word2.charAt(LOOPS_RUN))
{
LOOPS_RUN++;
}else
{
MISMATCHES_FOUND++;
LOOPS_RUN++;
}
}
Their you go, your while loop, check if their the same and do stuff. You might need more, but this is your basic loop. I would of explained it, but it was easier to show you. Don't copy it directly, because its probably has errors .. just the idea.