primer
Kool:
Tallinna Tehnikaülikool (TalTech, TTÜ)
Õppeaine:
ICD0019
Kategooria:
Informaatika
Kirjeldus:
Count the number of xx in the given string. We'll say that overlapping is allowed so xxx contains 2 xx. countXX(abcxx) 1 countXX(xxx) 2 countXX(xxxx) 3 int countXX(String str) int count 0 for (int i 0 i str.length()-1 i) if (str.substring(i i2).equals(xx)) count return count Given a string and a non-negative int n we'll say that the front of the string is the first 3 chars or what…