# -*- coding: utf-8 -*-
"""Rozwiązanie zadania 201."""

def add_document(simple_index, document, terms):
    """Tworzy inverted index."""
    count = len(simple_index.documents)
    simple_index.documents[document] = count
    for term in terms:
        if term not in simple_index.inverted_index:
            simple_index.inverted_index[term] = []
        simple_index.inverted_index[term].append(count)