def count_sentences(s, sentence_delimiters=set([".", "!", "?"])):
    """Counts the number of sentences in the given string."""
    cs = " ".join([p.strip() for p in s.split("\n")])
    count = 0
    for c in cs:
        if c in sentence_delimiters:
            count += 1
    return count