def validate_rdm_string(ops: str) -> str:
    """Check that a string for rdms are valid.

    Args:
        ops (str): String expression to be computed.

    Returns
        (str): Either 'element' or 'tensor'.
    """

    qftops = ops.split()
    nops = len(qftops)

    assert (nops % 2) == 0

    if any(char.isdigit() for char in ops):

        creation = re.compile(r"^[0-9]+\^$")
        annihilation = re.compile(r"^[0-9]+$")

        ncre = 0
        nani = 0

        for opr in qftops:
            if creation.match(opr):
                ncre += 1
            elif annihilation.match(opr):
                nani += 1
            else:
                raise TypeError("Unsupported behavior for {}".format(ops))

        assert nani == ncre

        return "element"

    creation = re.compile(r"^[a-z]\^$")
    annihilation = re.compile(r"^[a-z]$")

    ncre = 0
    nani = 0

    for opr in qftops:
        if creation.match(opr):
            ncre += 1
        elif annihilation.match(opr):
            nani += 1
        else:
            raise TypeError("Unsupported behvior for {}.".format(ops))

    if nani != ncre:
        raise ValueError("Unequal creation and annihilation operators.")

    return "tensor"