read s

while [[ ! -z "$s" ]]; do
    case "$s" in
        *dream)   s="${s%dream}"   ;;
        *dreamer) s="${s%dreamer}" ;;
        *erase)   s="${s%erase}"   ;;
        *eraser)  s="${s%eraser}"  ;;
        *)        echo NO; exit    ;;
    esac
done

echo YES
