A Appear Before All B
Submit solution
Points:
10
Time limit:
1.0s
Memory limit:
64M
Authors:
Problem type
Allowed languages
Java 19, Java 8
Description
輸入一個只包含字母 'a'
和 'b'
的字串 s
。
請判斷是否滿足以下條件:
所有的
'a'
都必須出現在所有的'b'
之前。
若符合條件,輸出 true
;否則輸出 false
。
Hint
str.charAt(i) 代表取出 str 字串的第 i 位字元
Sample input & output
Input #1
aaabbb
Output #1
true
Input #2
abab
Output #2
false
Comments