# Noncrossing 1212 Subsequences Indicative time limit: 0.5 seconds. Memory limit: 2048 MiB. Recalibrate as twice the slowest standard median in the target environment, rounded up to 0.5 seconds. See the [environment](../../../docs/评测环境与性能.md). ## Story A signal operator records two pulse types as 1 and 2 and wants to extract as many 1212 groups as possible. Marks pairing a 1 with its following 2 may nest, but may not cross. (This story was rewritten by GPT-6.) ## Formal Problem Statement Given a length-$n$ string $s$ containing only 1 and 2, choose as many subsequences as possible subject to these rules: 1. Each subsequence is exactly 1212: positions $a