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
n=input() l=['4','7'];c=0 for no in n: if no in l:c+=1 if c in map(int,l):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() x=0 for i in range(len(s)): if s[i]=='4' or s[i]=='7': x+=1 if str(x).count('4')+str(x).count('7')==len(str(x)): 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
string = input() cnt = 0 for c in string: if c == '4' or c == '7': cnt += 1 if cnt == 4 or cnt == 7: print("YES") else: print("NO") # 1481939198934
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
#Petyas Luck import pdb def Divs(g): c = 0 while g > 0: if (g % 10) == 7 or (g % 10) == 4: c +=1 g /= 10 return c n = int(raw_input()) if Divs(n) != 0 : if Divs(n) == 4 or Divs(n) == 7 : print "YES" else: print "NO" 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
sum = 0 s = input() for i in range(len(s)): if s[i]=='7': sum = sum + 1 elif s[i]=='4': sum = sum + 1 if sum==7 or sum==4: print("YES") else: print("NO")
PYTHON3
110_A. Nearly Lucky Number
Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d...
2
7
n = input() c = 0 if len(n)<2: c=0 else: for i in n: if i == '4' or i == '7': c+=1 #print('p4,p7,c',p4,p7,c) 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(input()) m=a.count('4') n=a.count('7') if m+n==4 or m+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
def is_lucky(number): num = number cnt = 0 if number == 0: return False while num > 0: digit = num % 10 if digit != 4 and digit != 7: return False num /= 10 return True def lucky_sum(number): num = number cnt = 0 while num > 0: ...
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 num = sys.stdin.readline() x = 0 for i in range(len(num)): val = num[i] if val in "47": x += 1 if str(x) 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=int(input()) count=0 while(n>0): digit=n%10; if(digit==4 or digit==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
li=list(input()) a=li.count("4") b=li.count("7") c=a+b 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
happy = ['4','7'] c = 0 s = input() for char in s: if char in happy: c += 1 found = c == 4 or c == 7 print('YES' if found else 'NO')
PYTHON3
110_A. Nearly Lucky Number
Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d...
2
7
s=input() sum=0 for i in range(len(s)): if (s[i]=='4')or(s[i]=='7'): 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
n = input() x = sum(c in "47" for c in n) print("YES" if x == 4 or x == 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
s=input() t=0 k=0 for i in range(0,len(s)): if int(s[i])==4 or int(s[i])==7: t=t+1 t=str(t) for i in range(0,len(t)): if int(t[i])!=4 and int(t[i])!=7: k=1 print("NO") break if (k==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
word = raw_input().split() def islucky(num): num = str(num) if len(num) == num.count('4') + num.count('7'): return "YES" return "NO" count = 0 for num in word: count += int(num) num = str(num) print islucky(num.count('4')+num.count('7'))
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
lis = [4, 7, 44, 47, 74, 77, 444, 447, 474, 477, 744, 747, 774, 777, 4444, 4447, 4474, 4477, 4744, 4747, 4777, 7444] #count = 0 #n = int(input()) #for i in lis: # if n%i==0: # count += 1 # break #if count ==1: # print('YES') #else: # print('NO') #s = '4774' #for i in s: # print(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
n=input() l=list(map(int,n)) x=l.count(4)+l.count(7) 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
#26 nearly lucky number l=input() n=l.count('4')+l.count('7') print('YES' if n==4 or n==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
number=input() number=list(number) lucky=0 for character in number: if character=='4': lucky+=1 elif character=='7': lucky+=1 lucky=list(str(lucky)) a=True for i in lucky: if i=='0': a=False if i=='1': a=False if i=='2': a=False if i=='3': a=False ...
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() n = (int)(n) count = 0 while(n>0): if(n%10 == 4 or n%10 == 7): count = count+1 n = n/10 if(count==0): print("NO") exit(0) while(count>0): if(count%10 !=4 and count%10!=7): print("NO") exit(0) count = count/10 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()) c = n.count('4') + n.count('7') if c == 4 or c == 7: print("YES") else: print("NO")
PYTHON3
110_A. Nearly Lucky Number
Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d...
2
7
# Solution to codeforces problem 110 A, almost lucky numbers num = input() count = 0 for letter in num: if letter in ['4', '7']: count += 1 print('YES' if count 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
st = input() count = 0 for item in st: count += item in {"7", "4"} for item in str(count): if item not in {"7", "4"}: 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
s = input() t = s.count('4') + s.count('7') if t == 4 or t == 7: print ("YES") else: print ("NO")
PYTHON3
110_A. Nearly Lucky Number
Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d...
2
7
#include <bits/stdc++.h> using namespace std; int d; long long n; int main() { cin >> n; while (n > 0) { if (n % 10 == 4 || n % 10 == 7) d++; n = n / 10; } if (d == 4 || d == 7) cout << "YES"; else cout << "NO"; return 0; }
CPP
110_A. Nearly Lucky Number
Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d...
2
7
import java.io.*; import java.math.BigInteger; public class Main { /** * @param args * @throws IOException */ public static void main(String[] args) throws IOException { BufferedReader in=new BufferedReader(new InputStreamReader(System.in)); PrintWriter out=new PrintWriter(Syste...
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
i =input() a = i.count ("7") b =i.count("4") d = a+b 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
n = input() l = 0 for d in n: if (d == '4') or (d == '7'): l += 1 res = (l > 0) while ((l > 0) and res): if (l % 10 != 4) and (l % 10 != 7): res = False l //= 10 if res: 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().strip() s = 0 s = n.count('4') + n.count('7') if s == 0: print("NO") else: while s: k = s % 10 if k != 4 and k != 7: print("NO") break s //= 10 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
def lucky(n): l=[int(x) for x in str(n)] count=0 flag=0 for i in range(len(l)): if(l[i]==4 or l[i]==7): count+=1 C=[int(x) for x in str(count)] for i in range(len(C)): if(C[i]==4 or C[i]==7): flag=1 else: flag=0 return "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() x = n.count('4') + n.count('7') x = str(x) if x.count('4') + x.count('7') == len(x): 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
t = input(); l = sum([1 for i in t if i in '47']); if(l == 4 or l == 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 sys # n as string n = sys.stdin.readline() num_luckies = 0 for digit in n: if digit == '4' or digit == '7': num_luckies += 1 if num_luckies == 4 or num_luckies == 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() if x.count('4')+x.count('7')==4 or x.count('4')+x.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
# import sys # sys.stdin = open('input.txt', 'r') # sys.stdout = open('output.txt', 'w') number = str(input()) flag = 0 nums = [ number[i] for i in range(len(number)) ] if '4' in set(nums) or '7' in set(nums): flag += 1 length = str(nums.count('4')+nums.count('7')) nums = [ length[i] for i in range(len(length)...
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() ln_count = 0 for w in s: if w == '4' or w == '7': ln_count += 1 is_lucky = True for n in str(ln_count): if n != '4' and n != '7': is_lucky = False break if is_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
n = list(input()) c = n.count('4') + n.count('7') l = [4, 7, 44, 47, 74, 77, 444, 447, 474, 477, 744, 747, 774, 777] print("YES") if c in l else print("NO")
PYTHON3
110_A. Nearly Lucky Number
Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d...
2
7
def is_lucky(n : int): for i in str(n): if i != '4' and i != '7': return False return True num = input() count = 0 for i in num: if i == '4' or i == '7': count += 1 if is_lucky(count): 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/problemset/problem/110/A # Petya loves lucky numbers. # We all know that lucky numbers are the positive integers whose decimal representations # contain only the lucky digits 4 and 7. # For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. # Unfortunately, not all numbers are lucky...
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 def main(): n = input() if str(n.count('4') + n.count('7')).replace('7', '').replace('4', '') == '': 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
a = input() count4 = 0 count7 = 0 for i in a: if int(i) == 7: count7 += 1 if int(i) == 4: count4 += 1 if count7 + count4 == 4 or count7 + count4 == 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() lucky_nb = [i for i in '47'] if len([i for i in a if i in lucky_nb])==4 or len([i for i in a if i in lucky_nb])==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() lucky_freq = sum(1 for c in n if c == '4' or c == '7') if lucky_freq == 4 or lucky_freq == 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 sys numb = input() numlist = list(numb) numb = 0 for i in range(len(numlist)): if(numlist[i] == '4' or numlist[i] == '7'): numb += 1 numlist = list(str(numb)) lucky = True for i in range(len(numlist)): if(numlist[i] != '4' and numlist[i]!= '7'): lucky = False if(lucky): 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
# prob 110 A inp= input() lst = list(inp) lucky = ["4","7"] count = 0 for elem in lst: if elem in lucky: 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
entrada = input() vetor = [] for i in entrada: if i == '7' or i == '4': vetor.append(True) if(len(vetor) == 7 or len(vetor) == 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() count=0 for i in a: 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()) print("YES" if (str(n).count("4")+str(n).count("7"))==4 or (str(n).count("4")+str(n).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=input() s=0 for i in n: if i=='4' or i=='7': s+=1 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
n = input() c = n.count('4') + n.count('7') print('YES' if c==4 or c==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
def lucky(number): if not isinstance(number, str): number = str(number) luckyNumbers = ["4", "7"] for char in number: if char not in luckyNumbers: return False return True string = input() count = 0 for char in string: if lucky(char): count += 1 if lucky(co...
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() lst=list(n) s=0 for i in range(len(lst)): if lst[i]=='4' or lst[i]=='7': s=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
number = input() number_of_7s = number.count("7") number_of_4s = number.count("4") total = number_of_7s + number_of_4s if total == 7 or total == 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
l = list(map(int, input())) c = 0 for x in l: if(x == 4 or x == 7): c+=1 d = list(map(int, str(c))) if all(x == 4 or x == 7 for x in d): print("YES") else: print("NO")
PYTHON3
110_A. Nearly Lucky Number
Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d...
2
7
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.next(); int score = 0; for (int i = 0; i < s.length(); i++) { if(s.charAt(i) == '4' || s.charAt(i) == '7'){ score++;...
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() sum=n.count('4')+n.count('7') if sum/7==1 or sum/4==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=int(input()) c=0 while n>0: num=n%10 if num == 4 or num == 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
num=input() ans=num.count('4') ans+=num.count('7') if(ans ==4 or ans ==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()) count=0 lucky=['4','7'] for a in num: if(a in lucky): 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
n = int(input()) k = str(n) x = [i for i in k] n = x.count('4') + x.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
import re n=input() y=re.findall(('[47]'),n) num=len(y) if num>0: num=str(num) x=re.findall(('[^47]'),num) c=len(x) if len(x)>0: print("NO") else: print("YES") elif num==0: 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")
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(): n = input() cnt = 0 for i in range(len(n)): if n[i] == '4' or n[i] == '7': cnt+=1 nl = 0 while cnt > 0: nl = 1 if cnt % 10 != 4 and cnt%10 != 7: nl = 0 break cnt = cnt // 10 if nl == 0: 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()) four = num.count('4') seven = num.count('7') if four + seven == 4: print('YES') elif four + seven == 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()) cnt=0 while(n>0): if n%10 in (4,7): cnt+=1 n//=10 if cnt 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
from collections import Counter def check(n): a = Counter(str(n)) if((a['4'] + a['7']) in [4,7]): return "YES" else: return "NO" if __name__ == '__main__': n = int(input()) print(check(n))
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() num = int(x) cnt = 0 for i in range(len(x)): if(x[i]=='4'or x[i]=='7'): cnt = 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
import java.io.*; public class HelloWorld{ public static void main(String []args)throws Exception { int c=0; BufferedReader hp= new BufferedReader(new InputStreamReader(System.in)); long a=Long.parseLong(hp.readLine()); long b=a; while(b>0) {long d=b%10; b=b/10; if(d==7||d==4) c++; } ...
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
inp = str(len([int(x) for x in input() if x=="4" or x=="7"])) print("YES" if "4" in inp or "7" in inp 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
def lucky(n,a=0): if int(n) > 7:return lucky(str(n.count('4')+n.count('7')),a+1) elif a >= 1: return 'YES' if n=='4' or n=='7' else 'NO' else:return 'NO' print(lucky(input()))
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 = sum(c in '47' for c in input()) print(('NO','YES')[k 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
num=(input()) mylist=(list(num)) count=0 for it in mylist: if it=='4' or it=='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
n = input() k = sum(1 for c in n if c in '47') print(('NO','YES')[k 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=input() if (n.count('4') + n.count('7'))==7 or (n.count('4') + n.count('7'))==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() { long long s; scanf("%I64d", &s); long long d = s; int n = 0; while (s > 0) { d /= 10; d *= 10; int a = s - d; if (a == 4 || a == 7) { n++; } s /= 10; d = s; } if (n == 0) { printf("NO"); return 0; } d ...
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
#110A.Nearly Lucky Number number=str(input()) n=len(number) i=0 j=0 while i<n: if number[i]=='4' or number[i]=='7': i=i+1 j=j+1 else: i=i+1 if j==4 or j==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()) l = list(n) count = 0 for i in l: if i == '7': count = count + 1 elif i == '4': count = count +1 if count == 0: print('NO') elif 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
#include <bits/stdc++.h> using namespace std; int main() { string n; cin >> n; int c = 0; for (int i = 0; i < n.size(); i++) { if (n[i] == '4' || n[i] == '7') c++; } if (c == 0) { cout << "NO" << endl; return 0; } while (c) { if (c % 10 == 4 || c % 10 == 7) c /= 10; else { ...
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
s = raw_input() if s.count('4') + s.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
isLucky = lambda t: ['NO','YES'][all(t == '4' or t == '7' for t in str(t))] print (isLucky(sum(t == '4' or t == '7' for t in str(input()))))
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 # -*- coding: utf-8 -*- """ Created on Sun Jun 14 19:50:25 2020 @author: aditya """ s=input() lucky=0 for i in s: num=int(i) if(num==4 or num==7): lucky=lucky+1 if((lucky==4) or (lucky==7)): print("YES") else: print("NO")
PYTHON3
110_A. Nearly Lucky Number
Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d...
2
7
st=input() a=st.count('4')+st.count('7') if a==4 or a==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
counter=0 a=str(input()) for c in a: if((c=='4') or (c=='7')): counter+=1 if(('4' in str(counter)) or ('7' in str(counter))): 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()) s=str(n) c=0 i=s.count('4')+s.count('7') if i==4 or i==7: c=1 if c==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 = int(input()) flag = 0 count = 0 for ele in str(n): if ele=='4' or ele=='7': count += 1 for ele in str(count): if ele != '4' and ele != '7': flag = 1 break if flag == 1: 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=int(input()) four=str(n).count("4") seven=str(n).count("7") total=four+seven 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
no=(input()) luckies=[4,7,44,77,477,47,74,744] c4=no.count('4') c7=no.count('7') count=c4+c7 if(count in luckies): 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()) res=0 while(n>0): r=n%10 if(r==4 or r==7): res+=1 n=n//10 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
import java.util.Arrays; import java.util.Scanner; import java.util.stream.IntStream; public class lucky2{ public static void main(String[] args) { Scanner in = new Scanner(System.in); long temp = in.nextLong(); int ini = 0 ; int cond = 0 ; int[] luckynumber = {4,7,47,74,447...
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
import java.util.Scanner; public class Main { private static Scanner in; public static void main(String[] args) { // TODO Auto-generated method stub String num; in = new Scanner(System.in); num = in.next(); char sym; int cnt = 0; int ln = num.length(); for (int i = 0; i < ln; i++) { sym = num.c...
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
s = raw_input() count = 0 for e in s: if e in '47': count += 1 flag = True for e in str(count): if e not in '47': flag = False print "YES" if flag 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.Scanner; public class LuckyNmber { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String n = scanner.next(); int count=0; for(int i=0; i<n.length(); i++) if(n.charAt(i)=='4' || n.charAt(i)=='7') ++count...
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() c=a.count('7') + a.count('4') if c==4: print("YES") elif c==7: print("YES") else: print("NO")
PYTHON3
110_A. Nearly Lucky Number
Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d...
2
7
n=input() n=list(n) k=n.count('4')+n.count('7') if k==4 or k==7: print("YES") else: print("NO")
PYTHON3
110_A. Nearly Lucky Number
Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d...
2
7
n=input() a=len(n) cnt=0 for i in n: if i=="4" or i=="7": cnt+=1 cnt2=0 for i in str(cnt): if i=="4" or i=="7": print("YES") exit() else: print("NO") exit()
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 = [ i=='4' or i=='7' for i in a] if sum(a) == 4 or sum(a) == 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() existence=0 for num in range(len(number)): if(number[num]=="4" or number[num]=="7"): existence+=1 if(existence==4 or existence==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 n: if(i=="4" or i=="7"): c+=1 if(c==4 or c==7): print("YES") else: print("NO")
PYTHON3
110_A. Nearly Lucky Number
Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Unfortunately, not all numbers are lucky. Petya calls a number nearly lucky if the number of lucky d...
2
7
n=input() 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