SundaySky interview question

Count number appearances per line, excluding duplicates