← All problemsSign in

Disjoint Substirng

Govinda does not like strings too much. He wants to check whether the given string contains two substrings. The two substrings are "BA" and "AB". The occurence of these two substrings should not be overlaped. Govinda spent almost one night to solve this problem but he couldn't.Can you help him ? If the given string contains these two substring then print "1" (without quotes) otherwise print "0"(w

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