Guys, I really need help on this one.
I need code to check the characters of a 4 charactered string. Think of it as similar to Mastermind, only, it uses 4 letter words instead of colors. It needs to check if the letter is correct and if it's in the right place or not.
example:
str1 = "CLAD" //this the word that the program thought of
str2 = "AAAA" //this is the word that the player entered
I've already transfered them to an array. From there, I compared the letter of both strings with the same index to check if the letter guessed by the player in index[0] is equal to the thought word in index[0] (I hope you understand). If they are, then they are the "Correct Letter at the Right Place", right?
In this example the "Correct Letter in the Right place" is the letter in index[2] of both strings.
Now, here's my problem, I can't seem to create the next kind of checking wherein it needs to check the remaining characters against the thought word, excluding the index that were already checked in the first checking (In this example, index[2]).
example2:
str1="PINK" //thought word
str2="KNNP" //guessed word by the player
in this example, the index that is checked correct in the right place is the character in index[2]. Using the second kind of checking, it should check the remaining 3 indexes. It still has to consider duplicates, though.
Please please please, this problem is really bugging me.