#!/usr/bin/python3.6
"""
Pipe package NEVRAs into this script to get package names.

NEVRA stands for Name, Epoch, Version, Release, Architecture. E.g.:

    $ echo fedora-packager-0:0.6.0.4-1.fc32.noarch | pkgname
    fedora-packager

You can omit epoch and/or architecture:

    $ echo fedora-packager-0.6.0.4-1.fc32 | pkgname
    fedora-packager

But, if version and release is omitted, the script can produce invalid results:

    $ echo fedora-packager | pkgname
    fedora

Created by Miro Hrončok, with suggestions from Adam Williamson.

This script is trivial, consider it Public Domain.
"""
import fileinput
import sys


if len(sys.argv) > 1:
    sys.exit(__doc__.strip())

for line in fileinput.input():
    print(line.rsplit("-", 2)[0])
