fork download
  1. # your code goes here
  2. H, M = map(int, input().split())
  3. if 0 <= H <= 23 and 0 <= M <= 59:
  4. if M < 45:
  5. N_M = abs(M - 45)
  6. if H == 0:
  7. print(23, 60 - N_M)
  8. else:
  9. print(H - 1, 60 - N_M)
  10. else:
  11. print("H, M")
Success #stdin #stdout 0.05s 9752KB
stdin
2 50
stdout
H, M