from typing import Tuple
from typing import Counter


def check_input(digits: int, value: str) -> Tuple[str, str]:
    """
    Check input from user
    Upon success, return (valid input, None)
    Upone failure, return (None, error message)
    """

    if not value.isdigit():
        return ('', f'Error! "{value}" is not a number')

    if len(value) != digits:
        return ('', f'Error! "{value}" is not {digits} digits long')

    if len(list(Counter(value).values())) != digits:
        return ('', f'Error! There are duplicate digits in "{value}"')

    return (value, '')