<>;$s=<>;print"101\n"=~$s|"010\n"=~$s?NO:YES