#C8527. Nearly Lucky String
Nearly Lucky String
Nearly Lucky String
Given a string s, determine if it is a nearly lucky string. A string is defined as nearly lucky if the number of lucky digits it contains is between 1 and 3, inclusive. Lucky digits are defined as 4 or 7. Mathematically, if we denote the count of lucky digits by \(\text{lucky\_count}\), then the string is nearly lucky if and only if \(1 \leq \text{lucky\_count} \leq 3\).
Your task is to implement a function that reads a string from standard input and prints True
to standard output if the string is nearly lucky, and False
otherwise.
inputFormat
The input consists of a single line containing a non-empty string s which may include digits, letters, and other characters.
Input Format:
A single line representing the string s
outputFormat
Output a single line: True
if the string is nearly lucky, and False
otherwise.
Output Format:
True or False## sample
447
True