```
String s1 = "aabbccaa";
String s2 = "aa";

```

I need to count how many times `s2` repeated in `s1`. I tried split text with no luck. Can someone help?

```
    String s1 ="aabbccaa";
    String s2 = "aa";
    int count = 0;
    for(int i = 0; i < s1.length(); i++) {
        for(int j = 0; j < s2.length(); j++) {
            if(s1.charAt(i) == s2.charAt(j)) {
                count++;
            }
        }

    }
    System.out.println(count);
    }
}

```