Im a beginner at java and I've been assigned this exercise I've been working on it for a while now but I just cant seem to get it right.
Return true if the string "cat" and "dog" appear the same number of times in the given string.
this is my code so far.
public boolean catDog(String str)
int count = 0;
for (int i=0; i<str.length(); i++)
String sub = str.substring(i, i+1);
any hints on how to fix it?