Write code to display strings in an array and count how many duplicate words appear (for example: john, anne, john, john, anne).
Print each input string in its original order, then return the number of distinct words that appear at least twice. Matching is case-sensitive, and an empty array is valid.
Contract: display_and_count_duplicates(words) accepts a list of strings and returns an integer.
def display_and_count_duplicates(words):