Back
Close
  • 41

Statement

 Goal

You are given a list of prescription drugs. Any two drugs with three or more letters in common (ignoring case) will have a bad interaction and should not be used together. Find the largest number of drugs in the list that can be used together.

Note that the same letter can match more than once, e.g. "Xanax" and "Viagra" each have two A's and thus have two matching letters.
Input
Line 1: Number of drugs
Next N Lines: List of drugs
Output
The most drugs that can be used together.
Constraints
N ≤ 100
Example
Input
3
Xanax
Ativan
Viagra
Output
2

A higher resolution is required to access the IDE