Convert Clock Format

Schedules and logs are often easier to read in 24-hour time, because there is no confusion between morning and evening hours. The function time_conversion receives a string s in the format hh:mm:ssAM or hh:mm:ssPM. Return the same time in HH:MM:SS format, handling the special cases: 12AM becomes 00, and 12PM stays 12.

Примеры

Ввод
"07:05:45PM"
Вывод
"19:05:45"
Ввод
"12:00:00AM"
Вывод
"00:00:00"
Ввод
"12:00:00PM"
Вывод
"12:00:00"

Нужно реализовать

def time_conversion(s: str) -> str:

Теги

strings
PostgreSQLv16

Hier erscheint das Ergebnis der Codeausführung

Visible tests
1
Input
"07:05:45PM"
Expected"19:05:45"
2
Input
"12:00:00AM"
Expected"00:00:00"
3
Input
"12:00:00PM"
Expected"12:00:00"
4
Input
"06:40:03AM"
Expected"06:40:03"
5
Input
"11:59:59PM"
Expected"23:59:59"
6
Input
"11:59:59PM!"
Expected"23:59:59P"
Focus radio
Paused · SomaFM · Fluid