Title Jan 24, 2023 • 1 min read public static int countA(String str) { int count = 0; while (str.length() > 0) { int pos = str.indexOf("A"); if (pos >= 0) { count++; str = str.substring(0, pos); } else { return count; } } return count; }