Doing my history reading and note-taking, I can't help but get tired of writing out all these long dates –– 1784 is six entire pencil lifts! jǝǝz!
As you can see, I –– like most challenge posters on this site –– am lazy when it comes to writing stuff. Thus, I ask you to please help me shorten some dates. Of course, your solution must be as short as possible since my hand is already tired from
writing typing out the test cases.
How do I shorten a date?
Well funny you should ask. It's fairly simple:
- Take two integers as input in whatever order you want (
- Take the larger of the two numbers, and take only the part not in the smaller number.
For example, given
2010, 2017, shorten
201_is in both at the same digit-places.
- Print or return the smaller number, followed by a dash and then the shortened larger number.
Bonus brownies for you if you figure out these dates' significance :) 1505, 1516 -> 1505-16 1989, 1991 -> 1989-91 1914, 1918 -> 1914-8 1833, 1871 -> 1833-71 1000, 2000 -> 1000-2000 1776, 2017 -> 1776-2017 2016, 2016 -> 2016- These dates lack significance :( 1234567890, 1234567891 -> 1234567890-1 600, 1600 -> 600-1600 1235, 1424 -> 1235-424 600, 6000 -> 600-6000