def text_counter(string):
    e_count, word_count = 0, 0
    is_word, is_e = False, False
    for char in string:
        is_e = is_e or (char == 'е')
        if is_word:
            if char in [' ', '.', '!', ',']:
                e_count += int(is_e)
                is_word, is_e = False, False
        elif char not in [' ', '.', '!', ',']:
            is_word = True
            word_count += 1
            if char is string[-1]:
                e_count += int(is_e)
    return word_count, e_count