← All problemsSign in

DotheBsFollowAs

Write a program to determine if a character string consists of a number of ‘A’s followed by an equal number of ‘B’s. At each point you may read only the next character of the string. The algorithm should not count the number of ‘A’s. Input Format: It contains the number of test cases T, followed by number of strings n, and each n next lines contain a string which can contain some number of A's a

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start