Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // A+ Computer Science - www.apluscompsci.com
- //Name -
- //Date -
- //Class -
- //Lab -
- import static java.lang.System.*;
- public class RecursionFunTwo {
- public static int countChickens(String word) {
- int n = word.indexOf("chicken");
- if (n < 0) return 0;
- return 1 + countChickens(word.substring(0, n) + word.substring(n + 7));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement