Task 1. Problem 1. Hirschberg algorithm