Sobes.tech
Intern — Senior

Determining a happy number in a sequence

livecode

Task condition

Write a function that takes a string of digits as input and returns a "lucky" number. A number X is considered lucky if it appears exactly X times in the given string. If there is no such number, the function should return 0.