When you say to go through good&bad words what do you mean by that?
Also, why would I need to find the number of bad words?
wouldn't a simple function like this work? Where badWords is an array, so that if titles.[i} contains any of the items from the array it would evaluate to true?
if(titles[i].contains(badWords)) {
setBadWords=true;
break;
r=255;
g=0;
b=0;
}
else(titles[i].contains(goodWords)) [
setGoodWords=true;
break;
r=0;
g=0;
b=0;
}
I'm just trying to simplify it assuming titles[i] already contains all the titles in an array.