Search is not available for this dataset
name stringlengths 2 112 | description stringlengths 29 13k | source int64 1 7 | difficulty int64 0 25 | solution stringlengths 7 983k | language stringclasses 4
values |
|---|---|---|---|---|---|
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | num = input()
c = num.count('4')+num.count('7')
if c==4 or c == 7:
print('YES')
else:
print("NO") | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | def lucky():
i = input()
total = i.count("4") + i.count("7")
# print(total)
# print(len(i))
if (total is 4 or total is 7):
print("YES")
else:
print("NO")
def main():
lucky()
if __name__ == "__main__":
main() | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | def isLucky(x):
string = str(x)
numlist = []
flagsum = 0
for i in range(len(string)):
number = int(string[i])
numlist.append(number)
for i in range(len(numlist)):
if(numlist[i] == 4) or (numlist[i] == 7) :
flagsum = flagsum + 1
... | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 |
import java.util.*;
public class ExamPrep03 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String str = sc.next();
int sayac = 0;
for (int i = 0; i < str.length(); i++) {
if(str.charAt(i)=='4' || str.charAt(i)=='7')
sayac++;
}
String tmp = Integer.toString(sayac... | JAVA |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n = raw_input()
m = n.count('4') + n.count('7')
print 'YES' if m == 4 or m == 7 else 'NO' | PYTHON |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n = input()
cnt = 0
for i in n:
if i == '4' or i == '7':
cnt += 1
flag = True
if cnt == 0:
flag = False
while cnt > 0:
i = cnt % 10
cnt //= 10
if i != 4 and i != 7:
flag = False
break
if flag:
print("YES")
else:
print("NO")
| PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | num=input()
lucky_digits=0
for i in num:
if i=='4' or i=='7':
lucky_digits+=1
else:
lucky_digits+=0
if lucky_digits==4 or lucky_digits==7:
print('YES')
else:
print('NO') | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | a = input()
mm = a.count("7") + a.count("4")
if mm == 7 or mm == 4:
print("YES")
else:
print("NO") | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 |
s = input()
n = list(s)
k = n.count('4') + n.count('7')
if k == 4 or k == 7 :
print('YES')
else:
print('NO')
| PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n = int(input())
n = str(n)
count_lucky_num = 0
result = 0
for i in n:
if i == '7' or i == '4': count_lucky_num += 1
for j in str(count_lucky_num):
if j == '7' or j == '4': result += 1
if result == len(str(count_lucky_num)): print("YES")
else: print("NO") | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | l = input()
s = str(l.count('4')+l.count('7'))
if(s.count('4')+s.count('7')==len(s)):
print("YES")
else:
print("NO") | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n=input()
t=list(n)
c=0
for i in t[0:]:
if(i=='4' or i=='7'):
c+=1
b=list(str(c))
a=1
for j in b:
if(j!='4' and j!='7'):
a=0
break
if(a==1):
print("YES")
else:
print("NO") | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n=(input())
a=list(n)
count=0
for i in range(len(a)) :
r=int(a[i])
if(r==4 or r==7) :
count+=1
if(count==4 or count==7) :
print("YES")
else :
print("NO") | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | def islucky(n):
l=list(str(n))
if '0' in l or '1' in l or '2' in l or '3' in l or '5' in l or '6' in l or '8' in l or '9' in l:
return False
else:
return True
n=input()
p=list(n)
k=p.count("4")+p.count("7")
if islucky(k):
print("YES")
else:
print("NO")
| PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | inp = input()
count = 0
for i in inp:
if(i=='7' or i=='4'):
count = count + 1
if(count == 7 or count == 4):
print("YES")
else:
print("NO")
| PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n = input()
m = list(n)
d = 0
for i in range(len(m)):
if m[i]!='4' and m[i]!='7':
d += 1
if (len(m) - d) == 4 or (len(m) - d) == 7:
print("YES")
else:
print("NO")
| PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | a=int(input())
x=str(a)
c=0
for i in range(len(x)):
if x[i]=='4' or x[i]=='7':
c+=1
if c==4 or c==7:
print("YES")
else:
print("NO") | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | import java.util.*;
public class Main110A {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
char[] cs = in.next().toCharArray();
int sum = 0;
for(char c : cs) {
if(c == '4' || c == '7') sum++;
}
System.out.println(sum == 4 || su... | JAVA |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | c=int(input())
d=str(c)
k=0
ar=['4','7']
for i in d:
if i in ar:
k=k+1
if k==7 or k==4:
print('YES')
else:
print('NO')
| PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | a=(input())
b=a.count('4')
c=a.count('7')
d=b+c
d=str(d)
e=d.count('4')
f=d.count('7')
if e+f==len(d):
print('YES')
else:
print('NO')
| PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | l = str(input())
s = 0
for i in l:
if i=='4' or i=='7':
s += 1
t = str(s)
for j in t:
if j != '4' and j != '7':
print('NO')
break
else:
print('YES')
| PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | a=int(input())
a=list(str(a))
T="YES"
H=0
for x in a:
if (x!="4" and x!="7"):
H=H
else:
H=H+1
H=list(str(H))
if (T == "YES"):
for x in H:
if (x!="4" and x!="7"):
T="NO"
print(T) | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n=input()
k="47"
c=0
m=0
for i in range(len(n)):
if n[i] in k:
c+=1
for i in str(c):
if i in k:
m=1
else:
print("NO")
break
if m==1:
print("YES")
| PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | if __name__ == '__main__':
n = input().strip(" ")
digits = ["4","7"]
lucky = 0
for i in n:
if i in digits:
lucky +=1
if lucky == 4 or lucky == 7:
print("YES")
else:
print("NO")
| PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | s=input()
l=len(s)
c7=s.count('7')
c4=s.count('4')
tot=c4+c7
if( tot==7 or tot==4):
print("YES")
else:
print("NO") | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n = input()
count = 0
for i in range(len(n)):
if n[i] == '4' or n[i] == '7':
count += 1
if count == 4 or count == 7:
print("YES")
else:
print('NO')
| PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n = raw_input()
l = (4,7)
p = n.count("4")
s = n.count("7")
if p+s ==4 or p+s ==7:
print"YES"
elif all((n in l) for i in n):
print"YES"
else:
print"NO" | PYTHON |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | import java.util.Scanner;
public class NearlyLuckyNumber {
public static void main(String[]args){
Scanner s=new Scanner(System.in);
long number=s.nextLong();
int flag=0;
int counter=0;
long numberTemp=number;
while(numberTemp>0){
double digit=numberTemp%10;
numberTemp=nu... | JAVA |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n = input()
n4 = 0
n7 = 0
for i in n:
if i == '4':
n4 +=1
if i == '7':
n7 += 1
if (n4 + n7) == 4 or (n4 + n7) == 7 :
print('YES')
else :
print('NO') | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | '''
A. Nearly Lucky Number
time limit per test2 seconds
memory limit per test256 megabytes
inputstandard input
outputstandard output
Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 ar... | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | x = input()
f=0
for i in x:
if i=='4' or i=='7':
f+=1
if f==4 or f==7:
print('YES')
else:
print('NO') | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n = raw_input()
count = 0
for i in n:
if i == '4' or i == '7':
count = count + 1
count = str(count)
out = 'YES'
for i in count:
if i != '4' and i != '7':
out = 'NO'
break
print out | PYTHON |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | a = input()
count = 0
for char in a:
if char == '4' or char == '7':
count += 1
if count == 4 or count == 7:
print("YES")
else:
print("NO")
| PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | x = input()
n = list(map(int,x))
num = 2*[0]
a = 0
b = 0
for i in n:
if i == 4:
num[0] += 1
if i == 7:
num[1] += 1
a += num[0]
b += num[1]
c = a + b
if c is 4 or c is 7:
print ('YES')
else:
print('NO') | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n=list(input())
c=0
if '4' in n:
c+=n.count('4')
if '7' in n:
c+=n.count('7')
if c==4 or c==7:
print('YES')
else:
print('NO') | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n=raw_input("")
l=list(n); s=['4','7'];t=0
n=int(n)
for i in l:
if i in s:
t+=1
if n<(10 ** 18) and n>1 and (t==4 or t==7):
print "YES"
else:
print "NO" | PYTHON |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n = input()
blank_list = []
lucky_list = ["4", "7"]
for i in n:
if i in lucky_list:
blank_list.append(i)
length = len(blank_list)
if length == 4 or length == 7:
print("YES")
else:
print("NO") | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n=input()
flag=0
for i in n:
if i=='4' or i=='7':
flag+=1
if flag==4 or flag==7:
print("YES")
else:
print("NO") | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | st = raw_input()
res = st.count('4')
res = res + st.count('7')
flag = True
for char in str(res):
if(char != '4' and char != '7'):
flag = False
if(flag):
print "YES"
else:
print "NO" | PYTHON |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | s=input()
n=len(s)
nd=0
for i in s:
if i=='4' or i=='7':
nd+=1
lst=list(str(nd))
nk=0
for i in lst:
if i=='4' or i=='7':
nk+=1
if nk==len(lst):
print('YES')
else:
print('NO')
| PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | lucky = (4, 7, 44, 47, 74, 77, 444, 447, 474, 477, 744, 747, 774, 777)
s = input()
lu = 0
for let in s:
if let == '4' or let == '7':
lu += 1
if lu in lucky:
print("YES")
else:
print("NO")
| PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n = 0;
char str[30];
scanf("%s", str);
int l = strlen(str);
for (int i = 0; i < l; i++)
if (str[i] == '4' || str[i] == '7') {
++n;
}
if (n == 4 || n == 7)
printf("YES\n");
else
printf("NO\n");
return 0;
}
| CPP |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n = input()
c = n.count('4')+n.count('7')
if c==4 or c==7:
print('YES')
else: print('NO') | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 |
import static java.lang.Math.*;
import java.util.*;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author HP
*/
public class Codeforces {
public static void main(S... | JAVA |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | HAPPY_NUMS = [4, 7, 47, 74]
def solve():
number = list(map(int, list(input())))
n_numbers = 10
numbers = [0] * n_numbers
for i in range(len(number)):
numbers[number[i]] += 1
if numbers[4] + numbers[7] in HAPPY_NUMS:
print("YES")
else:
print("NO")
if __name__ == "__mai... | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | s = sum(1 for x in input() if int(x) in (4, 7))
print('YNEOS'[(s != 4 and s != 7)::2]) | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | s = input()
l=list(s)
count=0
for i in l:
if int(i)==4 or int(i)==7:
count += 1
if count==4 or count== 7:
print("YES")
else:
print("NO") | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | from collections import Counter
if __name__=='__main__':
n = input()
digitMap = Counter(n)
count = digitMap['4'] + digitMap['7']
if(count == 4 or count == 7):
print("YES")
else:
print("NO") | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | import string
n = input()
count=n.count("7")+n.count('4')
a = str(count)
if a.count('4')+a.count('7') != len(a):
print("NO")
else:
print("YES")
| PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n = input()
count = 0
for i in n:
if i in ["4","7"]:
count+=1
if count == 4 or count == 7:
print("YES")
else:
print("NO")
| PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | lucky = [4, 7]
ss = input()
cnt = 0
for i in range(0, len(ss)):
if (ss[i] == '4' or ss[i] == '7'):
cnt += 1
if (cnt == 4 or cnt == 7):
print('YES')
else:
print('NO') | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | s=raw_input()
i=str(s.count('4')+s.count('7'))
j= i.count('4') +i.count('7')
if j==len(i):
print 'YES'
else:
print 'NO' | PYTHON |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
int c = 0;
string res;
for (int i = 0; i < s.size(); i++) {
if (s[i] == '4' || s[i] == '7') c++;
}
res = to_string(c);
for (int i = 0; i < res.size(); i++) {
if (res[i] != '7' && res[i] != '4') {
cout << "NO";
... | CPP |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | if __name__ == '__main__':
n = input()
nh = sum([d == '4' or d == '7' for d in n])
h = all([d == '4' or d == '7' for d in str(nh)])
print('YES' if h else 'NO')
| PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | number = input()
lucky_counter = 0
for i in range(len(number)):
if number[i] == '4' or number[i] == '7':
lucky_counter += 1
if lucky_counter == 4 or lucky_counter == 7 :
print("YES")
else:
print("NO") | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 |
liczba = input()
#liczba = int(liczba)
#print(liczba)
lista = []
for i in liczba:
lista.append(int(i))
#print(lista)
licznik = 0
for i in lista:
if i == 4 or i == 7:
licznik = licznik + 1
#print(licznik)
if licznik == 4 or licznik == 7:
print('YES')
else:
print('NO')
| PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | wt=input()
sdf=wt.count('4')+wt.count('7')
if sdf==4 or sdf==7:
print("YES")
else:
print("NO")
| PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n = list(input())
cont = 0
for i in n:
if i == '4' or i == '7':
cont += 1
print('YES') if cont == 4 or cont == 7 else print('NO')
| PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n = list(input())
cnt = n.count('4') + n.count('7')
if cnt == 7 or cnt == 4:
print("YES")
else:
print("NO") | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | #include <bits/stdc++.h>
int main() {
int c = 0;
long long int a;
scanf("%lld", &a);
while (a != 0) {
if ((a % 10 == 4) || (a % 10 == 7)) {
c++;
}
a = a / 10;
}
if ((c == 4) || (c == 7))
printf("YES");
else
printf("NO");
return 0;
}
| CPP |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | # Nearly Lucky Number
def luckyNumber(n):
four = n.count('4')
seven = n.count('7')
if (four + seven == 4 or four + seven == 7):
return "YES"
return "NO"
x = input()
print(luckyNumber(x)) | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | a=str(raw_input())
c=0
for i in range(len(a)):
if a[i]=='4' or a[i]=='7':
c=c+1
if c==4 or c==7:
print 'YES'
else:
print 'NO' | PYTHON |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | # https://codeforces.com/problemset/problem/110/A
"""
Lucky numbers are numbers whose digits are only 4 or 7
A nearly lucky number is a number whose number of lucky digits is a lucky number
"""
import sys
n = sys.stdin.readline()
lucky_digits = 0
for digit in n:
if digit == '4' or digit == '7':
lucky_di... | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n=input()
total=0
for i in n:
if i in ['4','7']:
total += 1
if total in [4,7]:
print('YES')
else:
print('NO')
| PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | num = input()
fancy = 0
for i in range(0,len(num)):
if num[i] == '4':
fancy+=1
elif num[i] == '7':
fancy+=1
#print(fancy)
if fancy == 4 or fancy == 7:
print("YES")
else:
print("NO")
'''
40047
NO
7747774
YES
1000000000000000000
NO
''' | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | str = raw_input()
key = 0
for ele in str:
if ele=='4' or ele=='7':
key=key+1
else:
pass
if key==4 or key==7:
print 'YES'
else:
print 'NO'
| PYTHON |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
short isLucky(unsigned long long n) {
short status = 1;
if (n == 0) status = 0;
while (n != 0) {
if (n % 10 == 4 or n % 10 == 7)
;
else
status = 0;
n /= 10;
}
return status;
}
int main() {
unsigned long long n, count = 0;
cin >> n;
wh... | CPP |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n=input()
n4=n.count("4")
n7=n.count("7")
if(((n4+n7)==4 or (n4+n7)==7) and (n4+n7)!=0):
print("YES")
else:
print("NO")
| PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | import sys
from random import choice,randint
sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]
def MI(): return map(int, sys.stdin.readline().strip().split())
def LI(): return list(map(int, sys.st... | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | a= int(input())
sum=0
b=str(a)
for i in range(len(b)):
if b[i]=="4" or b[i]=="7":
sum=sum+1
if sum==7 or sum==4:
print("YES")
else:
print("NO")
| PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | k = raw_input()
c = 0
for i in k:
c += ((i == '4') or (i == '7'))
if all(x == '4' or x == '7' for x in str(c)):
print "YES"
else:
print "NO" | PYTHON |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n=input()
c=0
for i in n:
if i=='7' or i=='4':
c+=1
if c==4 or c==7:
print('YES')
else:
print('NO')
| PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | s=input()
s=str(s.count('4')+s.count('7'))
if s.count('4')+s.count('7')==len(s):
print('YES')
else:
print('NO') | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n=input()
t=0
for x in range(len(n)):
if n[x]=='4' or n[x]=='7':
t+=1
t=str(t)
n=1
for x in range(len(t)):
if t[x]!='4' and t[x]!='7':
n=0
if n:
print('YES')
else:
print('NO')
| PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | num = input()
counter = 0
li = [4,7,44,47,77,74,444,447,474,747,774,777,477,744,4444,4447,4474,4744,4477,4747,4777,7777,7744,7774,7444,7474]
#4 -7
#44-47-74-77
#444-447-474-747-774-777
#4444,4447,4474,4744,4477,4747,4777
for i in num:
if i=="4" or i=="7":
counter+=1
if counter in li:
print("YES")
else:
... | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | number=list(input())
print("YES" if (number.count("4")+number.count("7"))==7 or (number.count("4")+number.count("7")==4) else "NO") | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | # exec(open('test.py').read())
ns = input()
n = 0
for x in ns:
if x == '4' or x == '7' :
n += 1
if n == 4 or n == 7:
print("YES")
else:
print("NO") | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | #include <bits/stdc++.h>
using namespace std;
int cant_ln(string x) {
int n = x.size();
int cont = 0;
for (int i = 0; i < n; i++) {
if (x[i] == '4' || x[i] == '7') {
cont++;
}
}
return cont;
}
int main() {
string n;
cin >> n;
if (cant_ln(n) == 4 || cant_ln(n) == 7)
cout << "YES";
els... | CPP |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | a = int(input())
a = str(a)
b = 0
for i in range(len(a)):
if a[i] == '4' or a[i] == '7':
b += 1
b = str(b)
if '1' in b or '2' in b or '3' in b or '5' in b or '6' in b or '8' in b or '9' in b or '0' in b:
print('NO')
else:
print('YES')
| PYTHON |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n=input()
c=0
for i in n:
if i=='4' or i=='7':
c+=1
for i in str(c):
if (i!='4') and (i!='7'):
print("NO")
exit()
print('YES') | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | '''
@author: wangguoxin
'''
def luck(v):
for i in str(v):
if i!='4' and i!='7':
return False
return True
s = input()
cnt = 0
for i in str(s):
if i=='4' or i =='7':
cnt+=1
if luck(cnt):
print 'YES'
else :
print 'NO' | PYTHON |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | s=str(input())
n=len(s)
c=0
for i in range(n):
if s[i]=='4' or s[i]=='7':
c=c+1
if c==4 or c==7:
print("YES")
else:
print("NO")
| PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n = raw_input()
if ((n.count('4') + n.count('7')) == 7) or ((n.count('4') + n.count('7')) == 4):
print "YES"
else:
print "NO" | PYTHON |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n=input()
print('YES' if str(n.count('7')+n.count('4')).count('7')+str(n.count('7')+n.count('4')).count('4')==len(str(n.count('7')+n.count('4'))) else 'NO')
| PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | s = 0
s2 = 0
n = raw_input()
for c in n:
if(c == '4' or c == '7'):
s += 1
for c in str(s):
if(c == '4' or c == '7'):
s2 += 1
if(s2 == len(str(s))):
print 'YES'
else:
print 'NO' | PYTHON |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.*;
public class Solution
{
static class FastReader
{
BufferedReader br;
StringTokenizer st;
public Fa... | JAVA |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n=input()
count=0
for i in n:
if i=='4'or i=='7':
count=count+1
if count==4 or count==7:
print('YES')
else:
print('NO') | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | s=input()
l=list(s)
if("4" in l or "7" in l):
x=l.count("4")
y=l.count("7")
z=x+y
if(z==4 or z==7):
print("YES")
else:
print("NO")
else:
print("NO")
| PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | s = input()
a = [num for num in s if num == '4' or num == '7']
cnt = len(a)
while cnt > 0 :
if (cnt % 10 != 4) and (cnt % 10 != 7):
print("NO")
exit()
cnt //= 10
print("NO" if len(a) == 0 else "YES") | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n=input()
l1=0
l1=len(n)
'''if len(n.replace('4','')) == 0:
print('NO')
elif len(n.replace('7','')) == 0:
print('NO')
else:
n=n.replace('4','').replace('7','')
temp=0
temp=len(n)
#print(temp)
if temp == 0:
print('YES')
else:
print("NO")'''
n=n.replace('4','')
n=n.replace(... | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | def is_lucky(s):
for char in s:
if char != "4" and char != "7":
return False
return True
from collections import Counter
num = Counter(input())
result = is_lucky(str(num["4"]+num["7"]))
print("YES" if result else "NO")
| PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | a=str(input())
b=list(a)
c=len(a)
d=b.count('4')
e=b.count('7')
if d+e==4 or d+e==7:
print('YES')
else:
print('NO')
| PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | #!usr/bin/python 3
import re
def main():
a=input()
b=re.findall('4',a)
c=re.findall('7',a)
if len(b)+len(c)==4 or len(b)+len(c)==7:
print('YES')
else:
print('NO')
if __name__=='__main__':
main()
| PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | Number=input()
List=[0] *len(Number)
for i in range(len(Number)) :
List[i] =Number[i]
count=0
for k in range(len(Number)) :
if List[k]=='4' or List[k]=='7' :
count+=1
List_1=[0]*len(str(count))
for j in range(len(str(count))) :
List_1[j]=(str(count))[j]
M=1
for x in range(len(List_1)):
if List_1[x]!='4' and L... | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | from collections import Counter
if __name__ == "__main__":
#take number as string
num = raw_input()
digitMap = Counter(num)
count = digitMap['4']+digitMap['7']
if(count==4 or count==7):
print "YES"
else:
print "NO" | PYTHON |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n = input()
x = 0
for i in n:
if i == '4' or i == '7':
x += 1
if x == 4 or x == 7:
print("YES")
else:
print("NO")
| PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | def is_lucky(num):
for n in num :
if(n != "4" and n != "7"):
return False
return True
num = input()
lucky_digits = 0
for n in num:
if(n == "4" or n == "7"):
lucky_digits += 1
if(is_lucky(str(lucky_digits))): print("YES")
else: print("NO")... | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | num = input()
if str(num).count('4') + str(num).count('7') in (4, 7):
print("YES")
else:
print("NO") | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | a=input()
b=a
a=[]
for i in range(len(b)):
a.append(b[i])
c=0
for i in range(len(a)):
if(a[i]=="4" or a[i]=="7"):
c+=1
if(c==4 or c==7):
print("YES")
else:
print("NO ") | PYTHON3 |
110_A. Nearly Lucky Number | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d... | 2 | 7 | n=input()
s=str(n)
length=len(s)
r=0
for i in range(length):
if s[i]=='4' or s[i]=='7' :
r=r+1
if r==4 or r==7 :
print ('YES')
else:
print ('NO') | PYTHON |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.