Postgresql Substring Between Two Strings Codeforces Sheet 2