Advertisement
Guest User

Brandy

a guest
Apr 25th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. // A+ Computer Science - www.apluscompsci.com
  2. //Name -
  3. //Date -
  4. //Class -
  5. //Lab -
  6. import static java.lang.System.*;
  7. public class RecursionFunTwo {
  8. public static int countChickens(String word) {
  9. int n = word.indexOf("chicken");
  10. if (n < 0) return 0;
  11. return 1 + countChickens(word.substring(0, n) + word.substring(n + 7));
  12. }
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement