Codeforces Beta Round #91 Problem D Lucky Segments