/*
    第2種情報処理技術者試験    平成5年度・秋期・午後 問13
                                BohYoh Shibata PREPARATION
*/

#include <stdio.h>

/* X, Y の小さいほうを選ぶ */
#define MIN(X, Y) (((X) < (Y))  ? (X) : (Y)  )
/* X, Y の大きいほうを選ぶ */
#define MAX(X, Y) (((X) > (Y))  ? (X) : (Y)  )


main()
{
    FILE *fp;
    int idx, tbl_idx, current, time, hour;
    long seq;
    char buf[81], type[2];
    static struct {
        int in;
        int out;
        int min;
        int max;
    } tbl[10];

    for (idx = 0; idx < 10; idx++) {
        tbl[idx].in  = 0;
        tbl[idx].out = 0;
        tbl[idx].min = 0;
        tbl[idx].max = 0;
    }
    current = 0;
    tbl_idx = -1;
    fp = fopen("user_log", "r");

    while (fgets(buf, 81, fp) != NULL) {
        sscanf(buf, "%ld%d%s", &seq, &time, type);
        hour = time / 100;
        while (tbl_idx < hour - 10) {
            tbl_idx++;
            tbl[tbl_idx].min = current;
            tbl[tbl_idx].max = current;
        }
        if ( type[0] == 'I') {
            tbl[tbl_idx].in++;
            current++;
            tbl[tbl_idx].max = MAX(tbl[tbl_idx].max,
                                   current);
        } else {
            tbl[tbl_idx].out++;
            current--;
            tbl[tbl_idx].min = MIN(tbl[tbl_idx].min,
                                   current);
        }
    }

    fclose(fp);
    printf("     Parking_Lot Service Report\n");
    printf("     Time      In   Out   Min   Max\n");
    for (idx = 0; idx < 10; idx++)
        printf("%2d:00-%2d:59%6d%6d%6d%6d\n",
                idx + 10, idx + 10, 
                tbl[idx].in, tbl[idx].out,
                tbl[idx].min, tbl[idx].max);
}