I have wrote a below code to find a keyword `co_e` in the below string, where `_` represents any other character.

It works good if I change the String to `"aaacodebbb"` or `"codexxcode"`
but if I change it to `"xxcozeyycop"` it throws `StringIndexOutOfBoundsException`

```
public int countCode(String str) {
    int count = 0;
    String result = "";
    boolean yes = true;
    for (int i = 0; i < str.length(); i++) {
        // yes = str.charAt(i+3);
        if (str.length() >= 3) {
            if (str.charAt(i) == 'c' && str.charAt(i + 1) == 'o' && str.charAt(i + 3) == 'e')
                count++;
        }
    }
    return (count);
}

```