def popular_words(text: str, words: list) -> dict:
    res = {}
    text = text.lower().split()

    for word in words:
        res[word] = text.count(word)

    return res


if __name__ == '__main__':
    print("Example:")
    print(popular_words('''
When I was One
I had just begun
When I was Two
I was nearly new
''', ['i', 'was', 'three', 'near']))

    assert popular_words('''
When I was One
I had just begun
When I was Two
I was nearly new
''', ['i', 'was', 'three', 'near']) == {
        'i': 4,
        'was': 3,
        'three': 0,
        'near': 0
    }

54b062ab5be889e75bdc603a3685f39b9f55bbb1
<mask token>

def popular_words(text: str, words: list) ->dict:
    res = {}
    text = text.lower().split()
    for word in words:
        res[word] = text.count(word)
    return res


<mask token>

def popular_words(text: str, words: list) ->dict:
    res = {}
    text = text.lower().split()
    for word in words:
        res[word] = text.count(word)
    return res


if __name__ == '__main__':
    print('Example:')
    print(popular_words(
        '\nWhen I was One\nI had just begun\nWhen I was Two\nI was nearly new\n'
        , ['i', 'was', 'three', 'near']))
    assert popular_words(
        '\nWhen I was One\nI had just begun\nWhen I was Two\nI was nearly new\n'
        , ['i', 'was', 'three', 'near']) == {'i': 4, 'was': 3, 'three': 0,
        'near': 0}

def popular_words(text: str, words: list) -> dict:
    res = {}
    text = text.lower().split()

    for word in words:
        res[word] = text.count(word)

    return res


if __name__ == '__main__':
    print("Example:")
    print(popular_words('''
When I was One
I had just begun
When I was Two
I was nearly new
''', ['i', 'was', 'three', 'near']))

    assert popular_words('''
When I was One
I had just begun
When I was Two
I was nearly new
''', ['i', 'was', 'three', 'near']) == {
        'i': 4,
        'was': 3,
        'three': 0,
        'near': 0
    }
