12. String Dolphin
Count how many times “dolphin” appears in a string. Except don’t count the word “dolphin” if it comes immediately after “shark “.
public static int cdol(String str)
Examples:
cdol("dolphin dolphin dolphin")
=> 3cdol("dolphin shark dolphin")
=> 1
Last modified February 17, 2022: AP CS Array unit - cleanup and organization. (d3e09c6)