-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathp10.java
35 lines (33 loc) · 995 Bytes
/
p10.java
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
32
33
34
35
import java.util.Scanner;
import java.io.BufferedReader;
import java.io.*;
public class Main
{
public static void main(String[] args) throws Exception
{
String n =new String();
Scanner sc=new Scanner(System.in);
n=sc.nextLine();
FileWriter writer = new FileWriter("input.txt");
writer.write(n);
writer.close();
String line;
int count = 0,count1 = 0;
FileReader file = new FileReader("input.txt");
BufferedReader br = new BufferedReader(file);
while((line = br.readLine()) != null)
{
String words[] = line.split("");
int nl= words.length;
for(int j=0;j<nl;j++)
{
if(Character.isDigit(line.charAt(j)))
{
count++;
}
}
}
br.close();
System.out.println(count);
}
}