Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public int countCode(String str) {
- int counter =0;
- for (int i =0; i < str.length(); i++) {
- if (str.charAt(i)=="c"){
- if ((str.charAt(i+1)== "o") && ((str.charAt(i+3)== "o")== "e")){
- counter++;
- }
- }
- }
- return counter;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement