I don't want "charAt(1);" to return the character at position 1 in the string... I want it to report all instances of "matching = 1;"
Take for example
int matching = 1;
int notMatching = 0;
int HI = matching;
int IH = notMatching;
int searchString = theString.charAt(notMatching);
int count = 0;
int index = 0;
while (0 < theString.length())
{
int = theString.charAt(matching);
if (theString.charAt(notMatching) == searchString)
{
count = count + 1;
}
index = index + 1;
}
Not a great example but basically what I want, or what this program is supposed to do is take a user input:
HIHIIH
and report the instances of HI spelled as IH... so the return would be for instance;
System.out.println("HI was spelled as IH" + count + "times");
EDIT: The "Duplicate" doesn't help me