#P9187. Team Breed Difference

    ID: 22342 Type: Default 1000ms 256MiB

Team Breed Difference

Team Breed Difference

Each of Farmer John's N barns has selected a team of C cows to participate in field day. Each cow is of one of two breeds: Guernsey or Holstein.

The difference between two teams is defined as the number of positions i (1 ≤ i ≤ C) at which the breeds of the cows differ. For every team, compute the maximum difference between that team and any other team.

Note: The time limit for this problem in Python is 15s. Other languages have the default time limit of 2s.

inputFormat

The first line contains two integers N and C — the number of teams and the number of cows in each team, respectively.

Each of the next N lines contains a string of length C consisting only of characters 'G' (Guernsey) and 'H' (Holstein) representing the team composition.

outputFormat

Output N lines. The ith line should contain a single integer, the maximum difference between team i and any other team.

sample

3 3
GHH
HGH
HGG
3

2 3

</p>