#include <stdio.h>
int main(void) {
calcula_estacionamento();
return 0;
}
void calcula_estacionamento()
{
int n=0,i=0;
const int MAX = 20;
char linha[MAX],hora_i[3]="",min_i[3]="",hora_f[3]="",min_f[3]="";
while(fgets(linha
,MAX
,stdin
)!=NULL
) {
while(linha[n] != 'h')
{
hora_i[i]=linha[n];
n++;
i++;
}
hora_i[i] = '\0';
i=0;
n++;
while(linha[n] != ' ')
{
min_i[i]=linha[n];
n++;
i++;
}
min_i[i] = '\0';
i=0;
n++;
while(linha[n] != 'h')
{
hora_f[i]=linha[n];
n++;
i++;
}
hora_f[i]= '\0';
i=0;
n++;
while(linha[n]!='\0' && linha[n]!='\n')
{
min_f[i]=linha[n];
n++;
i++;
}
min_f[i]= '\0';
printf("'%sh%s' - '%sh%s'\n",hora_i
,min_i
,hora_f
,min_f
); n=0;
i=0;
}
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgppbnQgbWFpbih2b2lkKSB7IAoJY2FsY3VsYV9lc3RhY2lvbmFtZW50bygpOyAKCXJldHVybiAwOwp9Cgp2b2lkIGNhbGN1bGFfZXN0YWNpb25hbWVudG8oKQp7CiAgICBpbnQgbj0wLGk9MDsKICAgIGNvbnN0IGludCBNQVggPSAyMDsKICAgIGNoYXIgbGluaGFbTUFYXSxob3JhX2lbM109IiIsbWluX2lbM109IiIsaG9yYV9mWzNdPSIiLG1pbl9mWzNdPSIiOwogICAgd2hpbGUoZmdldHMobGluaGEsTUFYLHN0ZGluKSE9TlVMTCkKICAgIHsKICAgIAl3aGlsZShsaW5oYVtuXSAhPSAnaCcpCiAgICAgICAgewogICAgICAgICAgICBob3JhX2lbaV09bGluaGFbbl07CiAgICAgICAgICAgIG4rKzsKICAgICAgICAgICAgaSsrOwogICAgICAgIH0KICAgICAgICBob3JhX2lbaV0gPSAnXDAnOwogICAgICAgIGk9MDsKICAgICAgICBuKys7CiAgICAgICAgd2hpbGUobGluaGFbbl0gIT0gJyAnKQogICAgICAgIHsKICAgICAgICAgICAgbWluX2lbaV09bGluaGFbbl07CiAgICAgICAgICAgIG4rKzsKICAgICAgICAgICAgaSsrOwogICAgICAgIH0KICAgICAgICBtaW5faVtpXSA9ICdcMCc7CiAgICAgICAgaT0wOwogICAgICAgIG4rKzsKICAgICAgICB3aGlsZShsaW5oYVtuXSAhPSAnaCcpCiAgICAgICAgewogICAgICAgICAgICBob3JhX2ZbaV09bGluaGFbbl07CiAgICAgICAgICAgIG4rKzsKICAgICAgICAgICAgaSsrOwogICAgICAgIH0KICAgICAgICBob3JhX2ZbaV09ICdcMCc7CiAgICAgICAgaT0wOwogICAgICAgIG4rKzsKICAgICAgICB3aGlsZShsaW5oYVtuXSE9J1wwJyAmJiBsaW5oYVtuXSE9J1xuJykKICAgICAgICB7CiAgICAgICAgICAgIG1pbl9mW2ldPWxpbmhhW25dOwogICAgICAgICAgICBuKys7CiAgICAgICAgICAgIGkrKzsKICAgICAgICB9CiAgICAgICAgbWluX2ZbaV09ICdcMCc7CiAgICAgICAgcHJpbnRmKCInJXNoJXMnIC0gJyVzaCVzJ1xuIixob3JhX2ksbWluX2ksaG9yYV9mLG1pbl9mKTsKICAgICAgICBuPTA7CiAgICAgICAgaT0wOwogICAgfQp9