← All problemsSign in

Longest Subsequence

You are given a string consisting of letters C, A and T only (not necessarily in order). You are asked to find the length of the longest "subsequence" in the string that consists of the letters C, A and T in order, i.e all the letters 'C' must appear before all the letters 'A' and all the letters 'A' must appear before all the letters 'T'. Input Input consists of a single line that has a string

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