A lucky number contains only digits 4 and 7. A nearly lucky number is one where the count of lucky digits is itself a lucky number. For example, 7747774 has seven lucky digits (five 7s and two 4s).
Since 7 is lucky, this number is nearly lucky. I'll show you how to extract and count specific digits. You'll use a loop to peel off digits one by one using modulo and division, count the 4s and 7s, then check if that count is lucky.
Read the problem statement before continuing. Think about how you'd verify if 4 or 7 or 47 is lucky, then how you'd count lucky digits in any number.