https://www.acmicpc.net/problem/1408
#include<stdio.h>
#include <string.h>
#include <stdlib.h>
int main() {
char n[10];
char m[10];
scanf("%s %s",n,m);
char* att[4]={NULL};
char* arr[4]={NULL};
int i=0;
char* pt=strtok(n,":");
while(pt!=NULL){
att[i]=pt;
i++;
pt=strtok(NULL,":");
}
i=0;
char* pr=strtok(m,":");
while(pr!=NULL){
arr[i]=pr;
i++;
pr=strtok(NULL,":");
}
int hour=atoi(arr[0])-atoi(att[0])+23;
int min=atoi(arr[1])-atoi(att[1])+59;
int sec=atoi(arr[2])-atoi(att[2])+60;
if(sec>=60){
sec-=60;
min+=1;
}
if(min>=60){
min-=60;
hour+=1;
}
if(hour>=24){
hour-=24;
}
printf("%02d:%02d:%02d",hour,min,sec);
}