DEV Community

Discussion on: Daily Challenge #71 - See you next Happy Year

Collapse
 
ignare profile image

My ugly answer. But I thought I would at least give this a go in python.


def find_happy_year(string)
    not_happy = True
    while(not_happy):
        for letter in string:
            same_same = 0
            for other_letter in string:
                if letter == other_letter:
                    same_same += 1
            if same_same > 1:
                not_happy = True
                string = str( int(string) + 1 )
                break
            else:
                not_happy = False
    print (string)