FPEvalDataset/LeetCodeProblem
0302
1{2 "id": 2243,3 "name": "check_if_all_as_appears_before_all_bs",4 "difficulty": "Easy",5 "link": "https://leetcode.com/problems/check-if-all-as-appears-before-all-bs/",6 "date": "1640476800000",7 "task_description": "Given a string `s` consisting of **only** the characters `'a'` and `'b'`, return `true` _if **every** _`'a'` _appears before **every** _`'b'`_ in the string_. Otherwise, return `false`. **Example 1:** ``` **Input:** s = \"aaabbb\" **Output:** true **Explanation:** The 'a's are at indices 0, 1, and 2, while the 'b's are at indices 3, 4, and 5. Hence, every 'a' appears before every 'b' and we return true. ``` **Example 2:** ``` **Input:** s = \"abab\" **Output:** false **Explanation:** There is an 'a' at index 2 and a 'b' at index 1. Hence, not every 'a' appears before every 'b' and we return false. ``` **Example 3:** ``` **Input:** s = \"bbb\" **Output:** true **Explanation:** There are no 'a's, hence, every 'a' appears before every 'b' and we return true. ``` **Constraints:** `1 <= s.length <= 100` `s[i]` is either `'a'` or `'b'`.",8 "public_test_cases": [9 {10 "label": "Example 1",11 "input": "s = \"aaabbb\"",12 "output": "true "13 },14 {15 "label": "Example 2",16 "input": "s = \"abab\"",17 "output": "false "18 },19 {20 "label": "Example 3",21 "input": "s = \"bbb\"",22 "output": "true "23 }24 ],25 "private_test_cases": [26 {27 "input": "ababbbbaabaababbbabbbb",28 "output": false29 },30 {31 "input": "aaaabbaabbaabab",32 "output": false33 },34 {35 "input": "aaabbabbbbabaabbbbababaabaababba",36 "output": false37 },38 {39 "input": "abbabbbbaaabbaabbbaabbbbbbabbaaaba",40 "output": false41 },42 {43 "input": "babababaaaabbbbaaaaabbbabbabbbabaaaaaababbbbaabbababbbbbbbaabbbaabbaaabbbbaabbbaaaabab",44 "output": false45 },46 {47 "input": "babaab",48 "output": false49 },50 {51 "input": "ababaaabbbaabbabaaaaabbaaaabbababaabaaaaaaabaaaabbaabaaaabbabbb",52 "output": false53 },54 {55 "input": "baababababbaabbabbbbbbabbbaababbbaabbbaaaabaabbbabbabbbabababbbabbbabaab",56 "output": false57 },58 {59 "input": "abb",60 "output": true61 },62 {63 "input": "abbabaabbbb",64 "output": false65 }66 ],67 "haskell_template": "checkString :: String -> Bool\ncheckString s ",68 "ocaml_template": "let checkString (s: string) : bool = ",69 "scala_template": "def checkString(s: String): Boolean = { \n \n}",70 "java_template": "public static boolean checkString(String s) {\n\n}",71 "python_template": "class Solution(object):\n def checkString(self, s):\n \"\"\"\n :type s: str\n :rtype: bool\n \"\"\"\n "72}