Company: Valuelabs - Evalground
Difficulty: medium
Find the cost of building a string. Conditions: To add character at end of string, it costs A To add substring at the end, it costs B Example: A- 8 B-9 bacbacacb is s output should be 42 Constraints: 1 < N < 10000