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 | def main():
n = input()
lucky_count = 0
for ch in n:
if ch == '4' or ch == '7':
lucky_count += 1
if lucky_count == 4 or lucky_count == 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 | num=str(input())
s=0
for i in range (len(num)):
if num[i]=='4' or num[i]=='7':
s+=1
if s ==4 or s==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(n):
n = str(n)
cnt = 0
for a in list(n):
if a == "4" or a == "7":
cnt += 1
if cnt == len(list(n)):
return True
else:
return False
n = input()
if lucky(n.count("4") + n.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 | print('YNEOS'[(sum(i in ('4','7')for i in input())) not in (4,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 | n=input()
c=0
e=0
for a in n :
if a=="4" or a=="7":
c=c+1
else:
e=e+1
c1=0
e1=0
b=str(c)
for t in b :
if t=="4" or t=="7":
c1=c1+1
else :
e1=e1+1
if e1==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 | n=input()
count=0
for i in n:
if(i=='4' and i=='7'):
count+=1
if(count==len(n)):
print("YES")
elif((n.count('4')+n.count('7'))==4 or (n.count('4')+n.count('7'))==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 = int(input())
x= str(x)
a= x.count('4')
b= x.count('7')
if a+b == 7 or a+b == 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=int(input())
tot=0
while n>0:
tmp=n%10
n//=10
if tmp==4 or tmp==7:
tot+=1
if tot==0:
print("NO")
else:
flag=1
while tot>0:
tmp=tot%10
tot//=10
if tmp==4 or tmp==7:
pass
else:
flag=0
break
if flag==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=list(input())
num=0
for i in range(len(n)):
if int(n[i])==4:
num+=1
elif int(n[i])==7:
num+=1
if num==4 or num==7:
ans='YES'
else:
ans='NO'
print(ans)
| 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 func(x):
s = str(x);
c = 0;
ans = 0;
for i in s:
y = int(i);
if y == 7:
c = c + 1;
elif y == 4:
c = c +1;
if c in [4,7]:
ans = "YES";
else:
ans = "NO"
print ans;
z = input();
func(z);
| 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=0
a = input()
for i in (a):
if i == '4' or i== '7':
n+=1
if n == 4 or n == 7 or n == 47 or n == 74:
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 | #
# Competitive programming: Nearly lucky number
# https://codeforces.com/problemset/problem/110/A
#
#
# n = integer
#
#
# inputs, logic, output
n = int(input())
nList = list(str(n))
def nearlylucky():
countlucky = 0
for number in nList:
if number == '4' or number == '7':
countlucky +... | 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=True
ctr=0
for i in n:
if i=='4' or i=='7':
ctr+=1
ctr=str(ctr)
for i in ctr:
if i!='4' and i!='7':
flag=False
break
if flag==True:
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()
z = 0
for y in range(0,len(x)):
if x[y] == '7' or x[y] == '4':
z += 1
if z == 4 or z == 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):
if n==0:
return 0
while n>0:
if n%10!=7 and n%10!=4:
return 0
n/=10
return 1
a=raw_input()
c=0
for i in a:
if i=='4' or i=='7':
c+=1
if islucky(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 | a=input()
fourcount=0
sevencount=0
for i in a:
if i == "4":
fourcount+=1
if i == "7":
sevencount+=1
if len(a) == 1:
print("NO")
elif fourcount == len(a) and fourcount != 7 and fourcount != 4:
print("NO")
elif sevencount == len(a) and sevencount != 7 and sevencount != 4:
print... | 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=[]
count=0
for i in n:
a.append(i)
if i=='7' or i=='4':
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=input()
l=list(n)
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 | n=input()
l_lucky=0
for i in n:
if i=='4' or i=='7':
l_lucky+=1
if l_lucky==4 or l_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 | def nearlyLuckyNumber(num):
luckyNum = num.count("4") + num.count("7")
return "YES" if luckyNum == 4 or luckyNum == 7 else "NO"
num = raw_input()
print nearlyLuckyNumber(num)
| 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()
c=0
for i in s:
if(i=='4' or i=='7'):
c+=1
c=str(c)
for i in c:
if(i=='4' or i=='7'):
continue
else:
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 | n = input()
a = n.count("7")
b = n.count("4")
tot = a + b
total = str(tot)
c = total.count("7")
d = total.count("4")
t = c + d
if t == len(total):
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(x):
if(x==0):
return False
while(x!=0):
if(x%10==4 or x%10==7):
pass
else:
return False
x//=10
return True
n = int(input())
number = 0
while(n!=0):
if(n%10==4 or n%10==7):
number += 1
n //= 10
#print(number)
if isLucky(number):
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()))
l=[int(x) for x in str(n)]
temp=0
for i in l:
if i==4 or i==7:
temp += 1
if temp== 4 or temp==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=list(s)
c={}
for item in s:
c[item] = c.get(item, 0) + 1
if(int(c.get('4',0))+int(c.get('7',0))==7 or int(c.get('4',0))+int(c.get('7',0))==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 = (raw_input())
a = str(len(n))
#print a[0]
k=0
for i in range(0,int(len(n))):
# print a[i]
if n[i] == '4':
k += 1
elif n[i] == '7':
k += 1
else:
continue
#print k
if k==4 or k==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 | def get_values():
string = input()
lucky = ['4', '7']
counter = 0
for i in string:
if i in lucky:
counter += 1
if counter == 4 or counter == 7:
return print('YES')
return print('NO')
get_values() | 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=0
for i in range(len(n)):
if n[i]=="7" or n[i]=="4": k+=1
string=str(k)
j=0
while j<len(string) and (string[j]=="4" or string[j]=="7" ):
j=j+1
if j==len(string) : 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() {
string s;
cin >> s;
int counter = 0;
for (int i = 0; i < s.size(); i++) {
if (s[i] == '4' || s[i] == '7') counter++;
}
if (counter == 4 || counter == 7)
cout << "YES" << endl;
else
cout << "NO" << endl;
}
| 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 | mys=int(input())
myl=[int(x) for x in str(mys)]
count=0
for x in myl:
if x==4 or x==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 | print('NYOE S'[sum(i in '47' for i in input()) in [4,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=str(input())
k=0
for i in range(len(s)):
if s[i]=='4' or s[i]=='7':
k+=1
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 = input()
cont = 0
for i in n:
if(i=='4' or i=='7'):
cont+=1
if(cont==4 or cont==7):
print('YES')
else:
print('NO')
# 1523225911366
| 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 | c=list(input())
k=0
t=len(c)
for i in c:
if(i=='4' or i=='7'):
k=k+1
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 | a=raw_input()
s=str(a.count("4")+a.count("7"))
if len(s)==s.count("4")+s.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()
c=str(n.count('4')+n.count('7'))
if len(c)==c.count('4')+c.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=int(input())
n=str(n)
a=n.count('4')
b=n.count('7')
sum=a+b
num=[]
num.append('4')
num.append('7')
if len(n)>1:
for i in range(0,2**(len(n))-2):
num.append(num[i]+'4')
num.append(num[i]+'7')
sum=str(sum)
if sum in 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 | n=input()
s=str(n)
c=0
for i in range(0,len(s)):
if s[i]=='7' or s[i]=='4':
c+=1
if c==7 or c==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 | if __name__ == '__main__':
n, k = input(), 0
for i in n:
if i == '4' or i == '7':
k += 1
a = set([int(i) for i in str(k)])
if set([1, 2, 3, 5, 6, 8, 9, 0]).intersection(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 | s=input()
n=s.count('4')+s.count('7')
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 | s=input()
k=s.count('4')
l=s.count('7')
if(k+l==7 or k+l==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>
using namespace std;
int main() {
string k;
cin >> k;
int c = 0;
for (int i = 0; i < k.size(); i++) {
if (k[i] == '4' || k[i] == '7') {
c += 1;
}
}
if (c == 4 || c == 7) {
cout << "YES\n";
} else {
cout << "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()
x=0
y=0
for i in n:
if (i=='4'):
x+=1
elif (i=='7'):
y+=1
if (((x+y)==4) or ((x+y)==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()
counter = 0
for i in x:
if int(i) in (4, 7): counter+=1
if counter 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()
n = a.count('4') + a.count('7')
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 | n = int(input())
n = str(n)
total_fours = n.count("4")
total_sevens = n.count("7")
total_lucky_nums = total_fours + total_sevens
if total_lucky_nums == 7 or total_lucky_nums == 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 str(n):
if i == '7' or i == '4':
count += 1
for i in str(count):
if i == '7' or i == '4':
pass
else:
print('NO')
quit()
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 | import math
n = int(input())
n1 = str(n)
c = 0
i = 0
k = 0
for i in range(len(n1)):
if(n1[i]=='7' or n1[i]=='4'):
c+=1
if(c>9):
st = str(c)
for i in range(len(st)):
if(st[i]!='7' or st[i]!='4'):
k = 1
break
if(k==1):
print("NO")
else:
print... | 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.io.*;
public class Nearly_Lucky_Number {
public static void main(String[] args) {
try {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String str = br.readLine();
int flag = 0;
char ch = ' ';
for (int i = 0; ... | 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()
lucky_fourth = n.count('4')
lucky_seven = n.count('7')
lucky_n = lucky_fourth + lucky_seven
if lucky_n==7 or lucky_n==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 | import sys
def main():
count = 0
while(True):
ch = sys.stdin.read(1)
if(ch == '4' or ch == '7'):
count += 1
if(ch == '\n'):
break
if(count == 4 or count == 7):
print "YES"
else:
print "NO"
main()
| 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 = raw_input()
count = 0
for x in n:
if int(x) == 4 or int(x) == 7:
count += 1
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=int(input())
c=0
while n>0:
r=n%10
if r==4 or r==7:
c+=1
n=n//10
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=int(input())
m=str(n)
y="7"
z="4"
x=0
for i in range (0,len(m)):
if m[i]==z or m[i]==y:
x=x+1
x=str(x)
if y and z in x:
print( "YES" )
elif x==y or x==z:
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 = list(map(int, str(a)))
c = len(a)
d = 0
for x in range(0,c):
if b[x] == 4 or b[x] == 7:
d+=1
if d == 4 or 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 | num = raw_input()
print 'YNEOS'[1-int(str(num.count('4')+num.count('7')).count('4')+str(num.count('4')+num.count('7')).count('7')==len(str(num.count('4')+num.count('7'))))::2] | 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.*;
public class HelloWorld{
public static void main(String []args)
{
Scanner sc = new Scanner(System.in);
String s = sc.next();
boolean flag = false;
int count=0;
for(int i=0;i<s.length();i++)
{
if(s.charA... | 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 | t = raw_input()
if (t.count('4') + t.count('7') in [4,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()
a = n.count('4')
b = n.count('7')
if (a + b) == 4 or (a + b) == 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 A {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
String s = in.nextLine();
System.out.println(f(s));
}
private static String f(String s) {
Set<String> set = new HashSet<>();
String[] chars = s.split("");
List<String> lis... | 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 | def digits(n):
if n < 10:
return [n]
else:
result = digits(n // 10)
result.append(n % 10)
return result
n = int(input())
n = sum((1 for v in digits(n) if v == 7 or v == 4))
if n != 0 and sum((1 for v in digits(n) if v != 7 and v != 4)) == 0:
print('YES')
else:
print('... | 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 | numstr = input()
total = numstr.count('7') + numstr.count('4')
if total == 4 or total == 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_str = input()
lucky = 0
for char in num_str:
if char == '7' or char == '4':
lucky = lucky + 1
if lucky == 7 or lucky == 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=raw_input()
print(['NO','YES'][set('47')>=set(str(n.count('7')+n.count('4')))])
| 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 (len(set(str(n.count("4")+n.count("7")))-set(["4","7"])))==0 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 | ch=list(input())
s7=ch.count('7')
s4=ch.count('4')
s=s7 + s4
if ( s== 4 or s==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()
v=('4','7')
count =0
if 1<=int(n)<=1000000000000000000:
for char in n:
if char in v:
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 | def L(number):
if number == 0 :
return False
while number > 0 :
x = number % 10
number /= 10
if not( x == 7 or x == 4 ) :
return False
return True
x = int(input())
C_7=0
C_4=0
while x > 0 :
y=x%10
x/=10
if y == 7:
C_7+=1
elif y==4:
... | 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
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 | n = str(int(input()))
count = 0
for i in n:
if i == "4" or 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=int(input())
a=str(n)
maiden=0
for i in range(len(a)):
if(a[i]=='7' or a[i]=='4'):
maiden=maiden+1
if(maiden==7 or maiden==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 | m = int(input())
n = 1
i = 0
k = 0
while m != 0:
n = m % 10
if (n % 10 == 4):
m //= 10
i += 1
else:
if (n % 10 == 7):
k += 1
m //=10
else:
m //=10
if (i+k==4) or (i+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 | a = input()
b = False
c = a.count('4')
d = a.count('7')
if c + d == 4 or c + d == 7 :
b = True
else :
pass
if b :
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 = {'4'}
c = {'7'}
d = {'4', '7'}
if set(a).intersection(d) == {'4', '7'} or set(a).intersection(b) == {'4'} or set(a).intersection(c) == {'7'}:
if a.count('4') + a.count('7') == 4 or a.count('4') + a.count('7') == 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 | a = input()
k = 0
for i in a:
if i in ['4', '7']: k += 1
k = str(k)
if len(k) == k.count('4') + k.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()
total = 0
for c in s:
if(c == '4' or c == '7'):
total += 1;
s = str(total)
done = True
for c in s:
if(c != '4' and c != '7'):
done = False
break
if(done):
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=0
for i in range(len(n)):
if int(n[i])==4 or int(n[i])==7:
s+=1
if s==4 or s==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/env python
# coding: utf-8
# In[73]:
masukan = input()
no = True
n = 0
for i in masukan:
if int(i) == 4 or int(i) == 7:
n = n+1
if float(n) / 4 == 1 or float(n) / 7 == 1:
no = False
if n == 0:
no = True
if no == True:
print ('NO')
else:
print ('YES')
# In[ ]:
| 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())
count=0
while(n!=0):
if n%10==4 or n%10==7:
count=count+1
n=n//10
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 suerte(n):
n=str(n)
L=[0,1,2,3,5,6,8,9]
for k in L:
if(str(k) in n):
return False
return True
n1=input("")
cont=0
for k in n1:
if(k=="4" or k=="7"):
cont+=1
if(suerte(cont) and cont!=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 | a = input()
a = str(a.count('7')+a.count('4'))
if a.count('4')+a.count('7')==len(a):
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=str(input())
count=0
for i in n:
if (i=='4' or 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 | x=input()
c=0
for g in x:
if g =='4'or g =='7':
c+=1
if c==7 or c==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 | par = raw_input()
lucky = "47"
count = 0
for i in par:
if i in lucky:
count += 1
flag = True
for i in str(count):
if not i in lucky:
print "NO"
flag = False
break
if flag == True:
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 = list(input())
c4 = n.count('4')
c7 = n.count('7')
if(c4 + c7 == 4 or c4 + c7 == 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()
count = 0
for i in s:
if i in '4':
count+=1
elif i in '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 | a=str(input())
count=0
for i in range(len(a)):
if a[i]=='4' or a[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()
counter = 0
for char in s:
if char == '4' or char == '7':
counter += 1
if counter == 4 or 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 | 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 | p=int(input())
m=str(p)
p=m.count('7')
q=m.count('4')
s=p+q
if s==7 or s==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 | # Har har mahadev
# author : @harsh kanani
from collections import Counter
s = input()
s1 = Counter(s)
count = s1['4'] + s1['7']
#print(count)
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=(input())
c=0
for i in range(len(n)):
if n[i]=='7' or n[i]=='4':
c=c+1
if c>0:
d=0
while c>0 :
r=c%10
c=c//10
if r!=7 and r!=4:
d=1
break
if d==1:
print('NO')
else:
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()
cnt = 0
a = [4, 7]
for i in n:
if i == "4" or i == "7":
cnt += 1
for i in a:
if cnt == i:
print "YES"
exit()
print "NO"
exit() | 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 | nums = input()
nums = list(nums)
nums = [int(nums[i]) for i in range(len(nums))]
ks = nums.count(4)
kl = nums.count(7)
sums = ks + kl
ls = [4, 7, 44, 47, 74, 77, 444, 447, 474, 744, 747, 777, 4444, 4447]
if sums in ls:
print("YES")
elif sums is not ls:
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 | string = input()
count = 0
for i in range(len(string)):
if string[i] == '4' or string[i] == '7':
count += 1
else:
continue
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()
lucky=[4,7]
n=0
for i in range(len(x)):
if int(x[i]) in lucky:
n=n+1
if n 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 | s=input()
say=0
for i in range(len(s)):
if s[i]=='4' or s[i]=='7': say+=1
if say==4 or say==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 = int(input())
contval = 0
while (num > 0):
check = num % 10
if(check == 7 or check == 4):
contval += 1
num = num // 10
if(contval == 4 or contval == 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 = raw_input()
luck = "47"
c = 0
for i in a:
if i in luck:
c += 1
print "YES" if c==4 or c==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 | s = input()
n = int(len(s))
boolean = False
#for i in range(0,n):
# if ((s[i] != '4')and(s[i] != '7')):
# boolean = False
#if ((n != 4)and(n != 7)):
# boolean = False
c = int(0)
for i in range(0,n):
if ((s[i] == '4')or(s[i] == '7')):
c = c+ 1
if ((c == 4) or (c == 7)): ... | PYTHON3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.