Problem8193--USACO 2023 US Open Contest, Silver Problem 2. Field Day

8193: USACO 2023 US Open Contest, Silver Problem 2. Field Day

[Creator : ]
Time Limit : 2.000 sec  Memory Limit : 256 MiB

Description

Each of Farmer John's N barns $(2≤N≤10^5)$ has selected a team of C cows (1≤C≤18) to participate in field day. The breed of every cow is either a Guernsey or a Holstein.
The difference between two teams is defined to be the number of positions i (1≤i≤C) at which the breeds of the cows in the i-th positions differ. For every team t from 1…N, please compute the maximum difference between team t and any other team.

Input

The first line contains C and N. The next N lines each contain a string of length C of Gs and Hs. Each line corresponds to a team.

Output

For each team, print the maximum difference.

Sample 1 Input

5 3
GHGGH
GHHHH
HGHHG

Sample 1 Output

5
3
5
The first and third teams differ by 5. The second and third teams differ by 3.

HINT

相同题目:USACO Silver

Source/Category