Added code for Hirschberg's algorithm