import os

def count_words_chars_lines(text):
    lines = text.split('\n')
    words = text.split()
    chars = len(text)

    return len(lines), len(words), chars

def read_file(file_path):
    try:
        with open(file_path, 'r') as file:
            text = file.read()
            return text
    except FileNotFoundError:
        print("File not found. Please check the file path and try again.")
        return None

def main():
    while True:
        print("\n1. Enter text")
        print("2. Read from file")
        print("3. Exit")
        choice = input("Enter your choice: ")

        if choice == '1':
            text = input("Enter your text: ")
            lines, words, chars = count_words_chars_lines(text)
            print(f"Words: {words}")
            print(f"Characters (including spaces): {chars}")
            print(f"Lines: {lines}")
        elif choice == '2':
            file_path = input("Enter the file path: ")
            text = read_file(file_path)
            if text:
                lines, words, chars = count_words_chars_lines(text)
                print(f"Words: {words}")
                print(f"Characters (including spaces): {chars}")
                print(f"Lines: {lines}")
        elif choice == '3':
            print("Exiting...")
            break
        else:
            print("Invalid choice. Please try again.")

if __name__ == "__main__":
    main()