#include <stdio.h>
#define Reset 0
#define Delta 1
int state = Reset;
long last_fract, last_secs;
char buf[1000];
int main(int argc, char *argv[])
{
long secs;
long fract;
int rc1, rc2;
long dt1, dt2;
char *ts, *tf;
char *index(), *rindex();
while (fgets(buf, sizeof(buf), stdin) != NULL) {
tf = index(buf, '.');
if (tf == NULL) {
state = Reset;
printf("%s", buf);
continue;
}
*tf = 0;
ts = rindex(buf, ' ');
if (ts == NULL) ts = buf;
else ts++;
*tf = '.';
tf++;
rc1 = sscanf(ts, "%ld", &secs);
rc2 = sscanf(tf, "%ld", &fract);
if (rc1 == 1 && rc2 == 1) {
if (state == Reset) {
printf("%s", buf);
state = Delta;
}
else {
dt2 = fract - last_fract;
dt1 = secs - last_secs;
if (dt2 < 0) {
dt2 += 1000000;
dt1--;
}
if (dt1 > 99) dt1 = 99; if (1) { char *b1, *b2;
b1 = index(buf, '[');
b2 = index(buf, ']');
if (b1 && b2) {
b1++; *b1 = 0;
if (dt1 > 0)
printf("%s%2ld.%06ld%s", buf, dt1, dt2, b2);
else
printf("%s %6ld%s", buf, dt2, b2);
}
else
printf("%2ld.%06ld %s", dt1, dt2, buf);
}
}
last_secs = secs;
last_fract = fract;
continue;
}
}
return 0;
}