import sys

def count_words_chars_lines(text):
    word_count = len(text.split())
    char_count = len(text)
    line_count = text.count('\n') + 1
    return word_count, char_count, line_count

def process_text_input():
    text = input("Enter the text:\n")
    word_count, char_count, line_count = count_words_chars_lines(text)
    print(f"Word count: {word_count}")
    print(f"Character count: {char_count}")
    print(f"Line count: {line_count}")

def process_file_input():
    file_path = input("Enter the file path:\n")
    try:
        with open(file_path, 'r') as file:
            text = file.read()
            word_count, char_count, line_count = count_words_chars_lines(text)
            print(f"Word count: {word_count}")
            print(f"Character count: {char_count}")
            print(f"Line count: {line_count}")
    except FileNotFoundError:
        print("File not found.")
    except IOError:
        print("Error reading the file.")

def main():
    while True:
        print("Select an option:")
        print("1. Input text")
        print("2. Input file")
        print("3. Exit")
        choice = input()

        if choice == '1':
            process_text_input()
        elif choice == '2':
            process_file_input()
        elif choice == '3':
            sys.exit(0)
        else:
            print("Invalid choice. Please try again.")

if __name__ == "__main__":
    main()