Question No 4
unknown
java
2 years ago
855 B
4
Indexable
Never
import java.io.*; import java.util.Scanner; import java.util.regex.*; public class Source { public static void main(String[] args) throws Exception { Scanner scanner = new Scanner(System.in); String str = scanner.nextLine(); Attendance obj1 = new Attendance(); System.out.println(obj1.checkRecord(str)); } } class Attendance { public String checkRecord(String str) { if (str.isEmpty()) { return "Not Eligible"; } int strSize = str.length(); int countA = 0; for (int i = 0; i < strSize; ++i) { if (str.charAt(i) == 'A') { if (countA >= 1) { return "Not Eligible"; } ++countA; } } return "Eligible"; } }