S - Exam Manipulation
题号:NC224136
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

A group of students is taking a True/False exam. Each question is worth one point. You, as their teacher, want to make your students look as good as possible—so you cheat! (I know, you would never actually do that.) To cheat, you manipulate the answer key so that the lowest score in the class is as high as possible.
What is the best possible lowest score you can achieve?

输入描述:

The first line of input contains two integers n (1 ≤ n ≤ 1,000) and k (1 ≤ k ≤ 10), where n is the number of students, and k is the number of True/False questions on the exam.
Each of the next n lines contains a string of length k, consisting only of upper-case ‘T’ and uppercase ‘F’. This string represents the answers that a student submitted, in the order the questions
were given.

输出描述:

Output, on a single line, the best possible lowest score in the class.
示例1

输入

复制
5 4
TFTF
TFFF
TFTT
TFFT
TFTF

输出

复制
2
示例2

输入

复制
3 5
TFTFT
TFTFT
TFTFT

输出

复制
5