this is a code for the  longest sequence