Created
April 25, 2024 02:03
-
-
Save JunJaBoy/edc788c987be3f3bc67db7e378563ad8 to your computer and use it in GitHub Desktop.
HackerRank/Algorithm/TimeConversion kotlin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.time.format.DateTimeFormatter | |
fun timeConversion(s: String): String { | |
val format = DateTimeFormatter.ofPattern("hh:mm:ssa") | |
val time = format.parse(s) | |
return DateTimeFormatter.ofPattern("HH:mm:ss").format(time) | |
} | |
fun main(args: Array<String>) { | |
val s = readln() | |
val result = timeConversion(s) | |
println(result) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment