Computer Science, asked by sanavngowda, 8 months ago

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 Rajeshsatav826piya
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