Rakuten Interview Question

One string manipulation question and one dp related problem