-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNearlyLucky.java
More file actions
31 lines (29 loc) · 858 Bytes
/
Copy pathNearlyLucky.java
File metadata and controls
31 lines (29 loc) · 858 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/**
* Created by MalhotR1 on 2/10/2017.
*/
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
public class NearlyLucky {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
char[] in = br.readLine().trim().toCharArray();
int count = 0;
for (int i = 0; i < in.length; i++) {
if (in[i] == '4' || in[i] == '7') count++;
}
if (count == 0 ) {
System.out.println("NO");
return;
}
while (count > 0) {
int rem = count % 10;
if (rem != 4 && rem != 7) {
System.out.println("NO");
return;
}
count /= 10;
}
System.out.println("YES");
}
}