I don't know, I think standard libraries are fair game. After all, there's no sense in reinventing the wheel. I know the J2SE implementation of most objects/methods are going to be a lot more efficent than my implementations.
Anyways, Java:
Code:
public int getLength(){
StringTokenizer toks = new StringTokenizer("Johnny Boy", "y");
return toks.countTokens() - 1;
}
Changed it as I didn't notice that the goal was to count "y's" orignially.