Similarity Number
CodeChefOpen on judge ↗
###Statement Chef switched from array to an string and decided to find out the **similarities** of the strings. The similarity of two strings is defined as the longest prefix common to both of the stings and the **similarity number** of the string is the sum of all such cases. Example: **S** = aaa, **S1** = aaab So S and S1 has **3** as aaa is longest prefix common to both.
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.
Sign in to chat with the tutor and save your progress.
Sign in to start