#C8983. Most Popular Dish
Most Popular Dish
Most Popular Dish
You are given n dishes and m guests. Each dish is evaluated by the guests with opinions represented by a string of length m. Each character in the string can be:
L
meaning the guest likes the dishD
meaning the guest dislikes the dishN
meaning the guest is neutral
The task is to determine the most popular dish based on the following criteria:
- The dish with the maximum number of likes ( \(L\) counts).
- If there is a tie in the number of likes, choose the dish with the fewer number of dislikes (\(D\) counts).
Dishes are numbered from 1 to \(n\). Print the 1-based index of the most popular dish.
inputFormat
The input is read from stdin and has the following format:
n m s1 s2 ... sn
Here, n
is the number of dishes and m
is the number of guests. Each of the following n
lines contains a string si
of length m
representing the opinions of the guests on the ith dish.
outputFormat
Output a single integer to stdout – the 1-based index of the most popular dish.
## sample3 4
LNDN
NDLL
DDDN
2