reformatDate 🌶️🌶️🌶️
A date is written as month/day/year, with slashes and no leading zeros, like "3/14/2024" or "12/5/1999". Write a method that takes one String parameter, date, and returns it written as year-month-day with hyphens, keeping the month and day exactly as they were written. For example, reformatDate("3/14/2024") should return "2024-3-14".
Preconditions: date has exactly two slashes and a four-digit year.
How many pieces are there, and how many slashes separate them? Where's the first one?
If you search the whole date again, would you just find the same slash? What should you search instead?
Was that second index measured inside rest, or inside the original date? Which one should you use it on?