← All problemsSign in

Asta and Good Subsequences

According to Asta, a String is good if it is composed of consecutive letters(in a cyclic way) i.e. ab or yz or za. Some examples of good Strings are 'abcd', 'xyzab'. Now, Asta is provided with a string $str$ of length $N$. You have to find the length of longest sub-sequence( https://en.wikipedia.org/wiki/Subsequence ) of $str$ which is also a good String. ###Input: - First line will co

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