Find an answer to your question Given a string S consisting of N letters 'a' and / or 'b' returns true.if all occurance of letter a comes before all occurance of letter b return true otherwise return false
Answers
Answered by
6
Answer:
Given a string str, return true string follows pattern anbn, i.e., it has a’s followed by b’s such that the number of a’s and b’s are same.
Examples:
Input : str = "aabb"
Output : Yes
Input : str = "abab"
Output : Yes
Input : str = "aabbb"
Output : No
Similar questions
Math,
3 months ago
Computer Science,
3 months ago
Math,
3 months ago
English,
8 months ago
Political Science,
8 months ago
Math,
1 year ago
Chemistry,
1 year ago