← All problemsSign in

Longest Article

CodeChefRating 2821Open on judge ↗

In Chefland every word contains exactly two letters. There exist two alphabets A of size N and B of size M, where the first letter of every word comes from A, and the second letter of every word comes from B. Every sentence is a space-separated list of words such that each letter from A is used exactly once in some word of the sentence and each letter from B is used at most once. In particular, e

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