fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int h1, m1, s1, h2, m2, s2;
  6. cin >> h1 >> m1 >> s1 >> h2 >> m2 >> s2;
  7. if (s2 < s1) {
  8. s2 += 60;
  9. m2 -= 1;
  10. }
  11. if (m2 < m1) {
  12. m2 += 60;
  13. h2 -= 1;
  14. }
  15. cout << h2 - h1 << " " << m2 - m1 << " " << s2 - s1;
  16. return 0;
  17. }
Success #stdin #stdout 0s 3416KB
stdin
9 45 0
12 30 30
stdout
2 45 30