- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSum.java
More file actions
Latest commit
29 lines (24 loc) · 737 Bytes
/
Copy pathSum.java
File metadata and controls
29 lines (24 loc) · 737 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
importjava.io.*;
importjava.util.*;
classSum {
publicstaticvoidmain(Stringargs[]) throwsIOException {
intcount = 0;
charstring;
Strings;
FileReaderfin = newFileReader("input1.txt");
Scannerfscan = newScanner(fin);
Scannerscan = newScanner(System.in);
FileWriterfout = newFileWriter("output.txt");
string = scan.next().charAt(0);
while (fscan.hasNext() == true) {
s = fscan.next();
if (s.indexOf(string) != -1) {
fout.write(s + "\n");
break;
}
}
fin.close();
fout.close();
// System.out.println(count);
}
}