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 | S = input()
cnt_four = S.count("4")
cnt_seven = S.count("7")
cnt = cnt_four + cnt_seven
cnt_str = str(cnt)
for s in cnt_str:
if s != "4" and s != "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 | s = input()
digits = 0
for cifra in s:
if '47'.find(cifra) != -1:
digits += 1
if digits != 0:
flag = True
while digits > 0:
if digits == 4 or digits == 7:
break
if digits % 10 != 4 or digits % 10 != 7:
flag = False
digits //= 10
if flag:
pr... | 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 p = 0;
for (int i = 0; i < s.size(); i++) {
if (s[i] == '4' || s[i] == '7') {
p++;
}
}
if (p == 4 || p == 7) {
cout << "YES";
} else {
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 | number = input()
size = len(number)
count = 0
for i in number:
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=(input())
c=n.count("4")
c=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 | num = list(input())
c4 = num.count('4')
c7 = num.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 | b = input('')
a = str(b)
count = 0
for letter in a:
if letter is '4' or letter is '7':
count = count + 1
if count is 4 or count 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 | a = input()
i = 0
b = len(a)
while i < len(a):
if a[i] != '4' and a[i] != '7':
b -= 1
i += 1
if b == 4 or 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 | n = int(input())
list = ['4', '7']
n = str(n)
c = 0
for i in n:
if i in list:
c = c + 1
else:
c = c
c = str(c)
l = 0
for a in c:
if a in list:
l = l + 1
else:
l = l
if l == len(c):
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 | i = str(input())
count = 0
for x in i:
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 | s=input()
l=len(s)
c=0
for i in range(l):
if s[i]=='4' or s[i]=='7':
c=c+1
h=0
if c==0:
h=1
print("NO")
while c:
if c%10!=4 and c%10!=7:
h=1
print("NO")
break
else:
c=c//10
if h==0:
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 | def main():
S = raw_input()
c = 0
for i in S:
if i in ["4","7"]:
c += 1
if c == 4 or c == 7:
print "YES"
return
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 = list(map(int,input()))
res = 'YES'
b = [4,7]
s = 0
for i in n:
if i in b:
s+=1
if not s in b:
res = 'NO'
print(res) | 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 Solution
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner scanner = new Scanner(System.in);
long number = scanner.nextLong();
String input = String.valueOf(number);
int count_four = input.length() - input.replace("4", "").len... | 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 = list(input())
x = list(str(n))
def lucky(a):
y = "YES"
for i in a:
if i == "4" or i == "7":
pass
else:
y = "NO"
return y
count = 0
for i in x:
if i == "4" or i == "7":
count += 1
print(lucky(list(str(count)))) | 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(raw_input())
s=str(n)
suma=0
for i in s:
if i=="4" or i=="7":
suma+=1
if suma==4 or suma==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 | num=input()
count4=0
count7=0
for i in range(len(num)):
if(num[i]=='4'):
count4+=1
elif(num[i]=='7'):
count7+=1
if((count4+count7)==len(num) and count4!=0 and count7!=0):
if(count4+count7==7 or count4+count7==4):
print("YES")
else:
print("NO")
elif(cou... | 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=0
for c in n:
if c in '47':
a+=1
if a 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 | a=input()
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_ls=[int(x) for x in input()]
lucky_num=[4,7]
cnt=0
for i in range(len(n_ls)):
if n_ls[i] in lucky_num:
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 = input()
a = s.count('4')
b = s.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 | def luck(n):
w=str(n)
if w.count('4')+w.count('7')==len(w):
return 1
else:
return 0
k=int(input())
s=str(k)
t=s.count('4')+s.count('7')
if luck(t):
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()
print('YES' if set(str(s.count('4') + s.count('7'))) <= set('47') 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 | import java.util.*;
public class HelloWorld{
public static void main(String []args){
Scanner sc=new Scanner(System.in);
long n=sc.nextLong();
long temp=n,cnt=0;
while(temp>0)
{
long r=temp%10;
if(r==7 || r==4)
cnt++;
temp/=10;
}
//... | 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 | a = input()
print("YES" if a.count("4")+a.count("7")==4 or a.count("4")+a.count("7") ==7 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 | n = int(input())
c = 0
c1 = 0
dc = 0
while (n>0):
x = n%10
if x == 4 or x == 7:
c+=1
n=n//10
while (c>0):
y = c%10
if y == 4 or y == 7:
c1 += 1
dc += 1
c = c//10
if c1 == dc != 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()
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 | f, s = 0, 0
for i in str(int(input())) :
if i == '4':
f += 1
elif i == '7':
s += 1
ans = True
for i in str(f+s):
if i not in {'4', '7'}:
ans = False
break
if not ans :
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 | from __future__ import division
from collections import Counter as ctr
from math import ceil, log, factorial
# reads a line of input and converts into a list of ints
# 1 1 3 => [1, 1, 3]
def rl():
return [int(i) for i in raw_input().split()]
# reads n lines of input (if n defined) and returns a list of strings
# w... | 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 lucky(n):
s = {4,7}
for i in str(n):
if int(i) not in s:
return False
return True
n = int(input())
m = 0
s = {4,7}
for i in str(n):
if int(i) in s:
m+=1
if lucky(m):
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=str(n.count('4')+n.count('7'))
if any(i in c for i in '01235689'):
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()
l=len(n)
count=0
for i in range(l):
if (int(n[i])==4 or int(n[i])==7):
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 | a = str(input())
a = a.rstrip()
x = 'YES'
y = 0
for i in a:
if i != '4' or i != '7':
x = 'NO'
if i == '4' or i == '7':
y += 1
if y == 4 or y == 7 or y == 47 or y == 74 or y == 447 or y == 477 or y == 744 or y == 747 or y == 777:
x = 'YES'
print(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 | n = str(input())
counter = 0
for i in n:
if i == '4' or i == '7':
counter -= -1
counter = str(counter)
for i in counter:
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 | from collections import deque
import math
import os
import random
import re
import sys
#n=list(map(int, input().split()))
#n=map(int, input().split())
def main():
n=int(input())
count=0
while n != 0:
if n%10 ==4 or n%10==7:
count+=1
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 | a = list(input())
print('YES' if '4' in list(str(a.count('4') + a.count('7'))) or '7' in list(str(a.count('4') + a.count('7'))) 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 | # t=int(input())
t=(input())
# n,k=list(map(int,input().split()))
c=0
for te in t:
if(te=="7" or te=="4"):
c+=1
c=str(c)
# print(c)
notFound=True
i=0
while(i<len(c) and notFound):
if(c[i]=="7" or c[i]=="4"):
i+=1
else:
notFound=False
if(notFound):
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 | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
while (getline(cin, s)) {
int count1 = 0;
for (int i = 0; i < s.size(); i++) {
if (s[i] == '4' || s[i] == '7') count1++;
}
if (count1 == 4 || count1 == 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 | lkys = [4,7,47,74,447,474,477]
n = input()
cnt = len(list(filter(lambda x: x in ('4','7'), list(n))))
print('YES' if cnt in (4,7) 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 | import sys
number = sys.stdin.readline()
flag = True
count = 0
for i in range(len(number)) :
digit = number[i]
if digit in '47':
count += 1
if str(count) in "47":
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 = raw_input()
print 'YES' if set(str(n.count('4') + n.count('7'))) <= set('47') 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=int(input())
s=str(n)
c=0
for i in s:
if i=="4" or i=="7":
c=c+1
f=str(c)
p=0
for i in f:
if i !="4":
if i!="7":
p=1
print("NO")
break
if p==0:
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 sys
n = map(int, list(sys.stdin.readline()[:-1]))
num = {}
for i in xrange(10):
num[i] = 0
for d in n:
num[d] += 1
x = num[4] + num[7]
s = map(int, list(str(x)))
for i in xrange(9):
num[i] = 0
def check(s):
for d in s:
if d != 4 and d != 7:
return False
return True
... | 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()
f=0
for i in range(len(n)):
if n[i] in '47':
f=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 = input()
o = 0
ln = ('4', '7')
for l in n:
if l in ln:
o += 1
for d in str(o):
if d not in ln:
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 | #include <bits/stdc++.h>
using namespace std;
const int INF = (int)1E9 + 5;
const double EPS = 1E-9;
const long long MOD = (long long)1E9 + 7;
const int dx[] = {-1, 0, 0, 1};
const int dy[] = {0, -1, 1, 0};
string s, tmp;
long long cnt;
int main() {
cin >> s;
for (int i = 0; i < (s.length()); i++)
if (s[i] == '... | 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 | from heapq import *
def int_raw():
return int(input())
def ss_raw():
return input().split()
def ints_raw():
return list(map(int, input().split()))
S =input()
def main():
CL = S.count("4")+S.count("7")
return "YES" if CL==4 or CL==7 else "NO"
print(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 | inp=input()
count=0
count2=0
for i in inp:
if i=='4':
count=count+1
elif i=='7':
count2=count2+1
if (count==4 or count==7) and count2==0:
print('YES')
elif (count2==4 or count2==7) and count==0:
print('YES')
elif count+count2==4 or count+count2==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()
luckyNumberList = ["4", "7"]
num = 0
for i in range(len(n) - 1, -1, -1):
if n[i] in luckyNumberList:
num = num + 1
n = n[:-1]
if str(num) in luckyNumberList or num == "47":
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
x = str(input())
counter = 0
for i in range(len(x)):
if x[i] == '7' or x[i] == '4':
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 | l=['4','7']
n=input()
m=0
ans=0
for i in range(len(n)):
if n[i] in l:
m+=1
m=str(m)
for j in range(len(m)):
if m[j] in l:
ans+=1
if ans==int(len(m)):
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)
a=l.count("4")
b=l.count("7")
res=a+b
if(res==4 or res==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
num = input()
digitmap = Counter(num)
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 | n = str(input())
near = 0
for i in range(len(n)):
if n[i] =='4' or n[i]=='7':
near+=1
if near == 4 or near == 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 | number = [int(x) for x in input()]
wu = 0
for i in range(len(number)):
if number[i-1] == 4 or number[i-1] ==7:
wu+=1
else:
continue
if wu == 4 or wu == 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.Scanner;
public class NearlyLucky {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
String s = scan.nextLine();
int count = 0;
for(int i = 0; i < s.length(); i++){
if(s.substring(i, i+1).equals("4")){
count++;
}
else if(s.substring(i, i+1).equals(... | 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 | lNum = raw_input()
numLuckyDigits = lNum.count('7') + lNum.count('4')
if (numLuckyDigits == 4 or numLuckyDigits == 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 f(n):
s=0
for a in list(str(n)):
if a=="4" or a=="7":
s+=1
if s==len(list(str(n))):
return True
else:
return False
s=input()
l=list(str(s))
s1=0
for a in l:
if a=="4" or a=="7":
s1+=1
if f(s1)==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 | n=input()
if n.count('4')+n.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 | num = input("")
num = list(num)
counter = 0
for i in num:
if int(i) == 4 or int(i) == 7:
counter += 1
if int(counter) == 4 or int(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()
print(["NO", "YES"][n.count("4")+n.count("7") in [4, 7]]) | 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())
c=0
while(n):
tmp=n%10
if(tmp==4 or tmp==7):
c+=1
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 | a=list(map(str,input()))
l=0
for i in range(len(a)):
if(a[i]=='4' or a[i]=='7'):
l+=1
if(l==4 or l==7 or l==44 or l==47 or l==74 or l==77):
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 lucky {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
long x = in.nextLong();
int counter = 0;
while (x > 0) {
if (x % 10 == 4 || x % 10 == 7)
counter++;
x = x / 10;
}
if (counter == 4 || counter == 7)
System.out.println("YES");... | 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()
list1=list(n)
sum =0
for i in list1:
if '7' == i or '4' == i:
sum +=1
if sum == 4 or sum==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 | number = input()
total = number.count("4") + number.count("7")
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 | n = int(input())
count = 0
strnum = str(n)
for i in range(len(strnum)):
if strnum[i] == "4" or strnum[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 | def gen(i):
global k, ans, flag
if ans == k and ans != 0:
flag = True
if i <= 3:
ans = ans * 10 + 4
gen(i + 1)
ans = ans // 10
ans = ans * 10 + 7
gen(i + 1)
ans = ans // 10
n = input()
k = 0
for i in range(len(n)):
if n[i] == '4' or n[i] =... | 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 nearlyLucky(y):
if y == 0:
return False
y = str(y)
for i in set(y):
if i not in ['4', '7']:
return False
return True
x = input()
y = x.count('4') + x.count('7')
if nearlyLucky(y):
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 | #Nearly Lucky Number
n=input()
c=0
for i in range(len(n)):
if n[i]=="4" or n[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=int(input())
y=n
c=0
z=n
count=1
while z>9:
z=z//10
count+=1
for i in range(count):
r=y%10
y=y//10
if r==4 or r==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 |
n=input()
num=list(n)
count=0
flag=0
for i in range(len(num)):
if num[i]=='4' or num[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()
count=0
for i in n:
if i=='4' or i=='7':
count+=1
k=str(count)
c=0
for x in k:
if x=='4' or x=='7':
c+=1
#print c
if c==len(k):
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 | k = 0
s = input()
for l in s:
if l == '4' or l == '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 | t=(raw_input());
m=[4,7];
c=0;
for i in range(len(t)):
if (t[i]=='4' or t[i]=='7'):
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 | import java.util.Scanner;
public class question {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
String s = sc.next();
int count = 0;
for(int i=0; i<s.length(); i++) {
char ch = s.charAt(i);
if( ch=='4' || ch=='7' )
count++;
}
if(count == 7 || cou... | 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 | k=input()
g=set(str(k.count('4')+k.count('7')))
if g=={'4','7'} or g=={'4'} or g=={'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 P110A_Nearly_Lucky {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long input = sc.nextLong();
long count = 0;
while(input != 0) {
long temp = input % 10;
input = input / 10;
if(temp... | 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=int(raw_input())
#print n
count=0
while(n>0):
if(n%10==4 or n%10==7):
count+=1
n/=10
if (count>0):
res=True
else:
res=False
while(count>0):
if(count%10!=4 and count%10!=7):
res=False
break
count/=10
if(res):
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()
a=int(s.count('4'))
b=int(s.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 | n = 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 | def main():
number = input("")
result = ("NO","YES")[isLuckyNumber(number)]
print(result)
def isLuckyNumber(number):
strNumber = str(number)
luckyDigits = []
for digit in strNumber:
if isLuckDigit(digit):
luckyDigits.append(digit)
if len(luckyDigits) == 4 or len(... | 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=int(input())
count=0
for i in str(s):
if i=="4" or i=="7":
count+=1
b=count
if b==4 or 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 | s = input()
t = s.count('4')+s.count('7')
flag = 1
for i in str(t):
if i != '4' and i != '7':
flag = 0
print('NO')
break
if flag: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()
total = n.count("7") + n.count("4")
if 7 is total or 4 is 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 | n = list(input())
index = 0
for i in n :
if i == '4' or i == '7':
index += 1
else :
index += 0
lol = None
a = list(str(index))
for i in a:
if i == '4' or i == '7':
lol = 'YES'
else :
lol = 'NO'
break
print(lol)
| 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
input = sys.stdin.readline
############ ---- Input Functions ---- ############
def inp():
return(int(input()))
def inlt():
return(list(map(int,input().split())))
def insr():
s = input()
return(list(s[:len(s) - 1]))
def invr():
return(map(int,input().split()))
c = True
cnt = 0
n = inp()... | 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 = len([x for x in n if x in '47'])
print("YES" if (count == 4 or count == 7) 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 | ln= (4, 7, 44, 47, 74, 77, 444, 447, 474, 477, 744, 747, 774, 777)
n = raw_input()
if n.count("4") + n.count("7") in ln:
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=str(input())
num=n.count('4')+n.count('7')
if num==4 or num==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(input())
c=0
c=n.count("4")
c+=n.count("7")
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 | a=input()
j=a.count('4')+a.count('7')
m=str(j).count('4')+str(j).count('7')
if m==len(str(j)):
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=input();k=(k.count("7")+k.count("4"));print("YES" if k==4 or k==7 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=input()
k=str(a)
p=list(k)
r=len(p)
i=0
b=0
for i in range(r):
if(int(p[i])==7 or int(p[i])==4):
b=b+1
if(b==7 or 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 | def Check(n) :
n = set(list(str(n)))
for x in n :
if (x == '0' or x == '1' or x == '2' or x == '3' or x == '5' or x == '6' or x == '8' or x == '9') :
return False
return True
n = list((raw_input()))
count = 0
for x in n :
if (x == '4' or x == '7') :
count += 1
ans = Check(count)
if (ans == False) :
print "... | 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())
count = 0
while(n!=0):
if n%10 == 4 or n%10 == 7:
count += 1
n //= 10
count = str(count)
flag = True
for x in count:
if x != '4' and x != '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 | #http://codeforces.com/contest/110/problem/A
number=raw_input()
number=list(number)
result=0
for item in number:
if item in ['4','7']:
result+=1
if result 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()
l = list(n)
count = l.count('4') + l.count('7')
c = list(str(count))
if ('1' not in c) and ('2' not in c) and ('3' not in c) and ('5' not in c) and ('6' not in c) and ('8' not in c) and ('9' not in c) and( ('4' in c) or ('7' in c)):
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()
x = 0
a = len(inp)
for num in inp:
if num == '4' or num == '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 | #!/usr/bin/env python3
from sys import stdin
def solve(tc):
li = stdin.readline()
cnt = sum(1 for y in li if y=='4' or y=='7')
res = sum(1 for y in str(cnt) if y=='4' or y=='7')
print("YES" if res else "NO")
if not __debug__:
infile = __file__.split('.')[0] + "-test.in"
stdin = open(infile, ... | PYTHON3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.