Under construction

Still being built. Things may change

Catching the Troublemakers

Time limit1sMemory limit1024 MB

Summary
For each member's solve record over M days, find the longest run of days without a solve, then count how many distinct longest-run values there are.
Level

Easy2 of 10

Topics
Simulation, String
Solved
No attempts yet

Problem

In 2034, the KPSC club at Kookmin University became so famous that KPSC was better known than Kookmin University itself.

Because of this reputation, many people wanted to join KPSC, but to keep the club's reputation, it accepted only a limited number of members and rejected everyone else.

However, after joining, some members began to neglect their programming studies and disappeared.

The vice club leader, outraged by this situation, decided to introduce a new rule: expulsion using the reverse streak. A reverse streak is the number of consecutive days a person has not solved a problem. In other words, if someone has not solved any problem for xx consecutive days, that is a reverse streak of xx days.

Help the vice club leader identify the 'troublemaker' members who disappear after joining and neglect club activities.

Input

The first line contains the number of KPSC members NN and the length of the daily activity record MM. (1≤N,M≤200)(1 \leq N, M \leq 200)

Each of the next NN lines gives one member's activity record and name, separated by a space.

The activity record is MM characters separated by spaces. If the ii-th character is *, the member solved a problem on day ii. If it is ., the member did not solve a problem on day ii.

Each name is a string of 1 to 10 lowercase English letters, and no two names are the same.

Output

The first line prints the number of distinct values among the members' longest reverse streaks.

From the next line, print each member's longest reverse streak and name, one per line, in input order. Here, the longest reverse streak is the largest reverse streak achieved within the MM days.

Examples2

  1. Example 1

    Input
    3 10
    * * * * * * * * * * saywoo
    * . * . * . * . * * captain
    * * * * * . . . * * usb
    
    Expected output
    3
    0 saywoo
    1 captain
    3 usb
    
  2. Example 2

    Input
    3 10
    * * * * * * * * * * saywoo
    * . . . * . * . * * captain
    * * * * * . . . * * usb
    
    Expected output
    2
    0 saywoo
    3 captain
    3 usb