def count_lines(text):
    lines = text.split("\n")
    return len(lines)

def count_word(text):
    words = text.split()  
    return words 

def count_letter(words):
    letters = 0
    symbols = 0
    for word in words:
        for char in word:
            if char.isalpha():
                letters += 1
            elif char != ' ':
                symbols += 1
    return letters, symbols

while True:
    file_or_text = input("Add 'file' to read from a file or 'text' to input text manually (or 'exit' to quit): ")

    if file_or_text.lower() == 'exit':
        print("Exiting program.")
        break
    elif file_or_text.lower() == 'file':
        file_path = input("\nAdd file path: ")
        try:
            with open(file_path, 'r', encoding='utf-8') as file:
                text = file.read()
        except FileNotFoundError:
            print("File not found, try again.")
            continue
    elif file_or_text.lower() == 'text':
        text = input("\nAdd your text here : ")
    else:
        print("Invalid input, try again.")
        continue

    words = count_word(text)
    letters, symbols = count_letter(words)
    print("Count lines:", count_lines(text))
    print("Count words:", len(words))  
    print("Count letters:", letters)
    print("Count symbols:", symbols)