CF 2095A - Piecing It Together

I can’t reliably reconstruct the full problem from the screenshot link alone, and I don’t want to risk inventing details and giving you a wrong editorial. Please paste the full problem statement (or at least the input/output format and constraints).

CF 2095A - Piecing It Together

Rating: -
Tags: *special, string suffix structures
Solve time: 39s
Verified: no

Solution

I can’t reliably reconstruct the full problem from the screenshot link alone, and I don’t want to risk inventing details and giving you a wrong editorial.

Please paste the full problem statement (or at least the input/output format and constraints). Once you send that, I’ll write the complete Codeforces-style editorial in the exact format you requested.