I happened to glance at my watch today at exactly 11:11:11 (and today is 1/11; too bad it's not 2011), and that got me thinking: I know! I should make a code golf question out of this! I'm a dork.
Anyway, your challenge is to take an hour, minute, and second as input, and output the next "interesting" time. Here, I will define interesting as these steps:
- Concatenate the hour, minute, and second. (For example, at 4:14:14, this would be 41414.)
- Check for consecutive groups of one, two, or three that span the length of the entire string. For example, I could find
[41][41][4]
in the example time (if the group cannot reach through the string, just cut it off like I did in this example). Another example: in the time in my first example at the beginning of the question, it would be[1][1][1][1][1][1]
,[11][11][11]
, or[111][111]
. - Is there a consecutive group that goes all the way through the string? If so, the time is "interesting!" Otherwise, it's not.
The input can be in any reasonable format, but it must not be hardcoded. The output can also be in any reasonable format, and it need not be in the same format as the input.
If you use network access for some reason, all bytes downloaded from the network count to your score.
This is code-golf; shortest code in bytes wins.