def count_text():
    text = input("Enter the text: ")
    words = text.split()
    num_words = len(words)
    num_chars = len(text)
    num_lines = text.count('\n') + 1

    print("Number of words:", num_words)
    print("Number of characters:", num_chars)
    print("Number of lines:", num_lines)


def main():
    while True:
        choice = input("Enter 't' for text input, 'f' for file input, or 'q' to quit: ")
        
        if choice.lower() == 't':
            count_text()
        elif choice.lower() == 'f':
            file_path = input("Enter the file path: ")
            try:
                with open(file_path, 'r') as file:
                    text = file.read()
                    print("File content:\n", text)
                    count_text()
            except FileNotFoundError:
                print("File not found. Please provide a valid file path.")
        elif choice.lower() == 'q':
            break
        else:
            print("Invalid choice. Please try again.")


if __name__ == '__main__':
    main()