Sponsored
Use these hints if you're stuck. Try solving on your own first.
Use Dynamic Programming along with Aho-Corasick or Hashing.
Solve with full IDE support and test cases