Postgresql Substring Between Two Strings Codeforces Sheet 5