Check if All A's Appears Before All B's Problem
Check if All A's Appears Before All B's Problem — ExecCode Easy DSA Practice
Solve the Check if All A's Appears Before All B's problem on ExecCode. Free online easy DSA practice in String. Write and run code in Java, C++, Python — no signup required to run.
Problem description
Description You are given a string s consisting of only the characters 'a' and 'b', return true if every 'a' appears before every 'b' in the string. Your task is to otherwise, return false.
Examples
Input {"s": "aaabbb"}; Output True. Input {"s": "abab"}; Output False
Constraints
1 <= s.length <= 100 s[i] is either 'a' or 'b'.
Practice Check if All A's Appears Before All B's free on ExecCode. Browse DSA problems, topic map, and placement guides.