SHOW:
|
|
- or go back to the newest paste.
1 | import java.util.*; | |
2 | import java.io.*; | |
3 | class Question1 { | |
4 | public static void main(String[] args) throws IOException{ | |
5 | int A = 0; | |
6 | int C = 0; | |
7 | int G = 0; | |
8 | int T = 0; | |
9 | - | Scanner input = new Scanner(new File("input.txt")); |
9 | + | Scanner input = new Scanner(new File(args[0])); |
10 | String s = input.next(); | |
11 | for (int i = 0; i < s.length(); i++) { | |
12 | if (s.charAt(i) == 'A') { | |
13 | A++; | |
14 | }else if (s.charAt(i) == 'C') { | |
15 | C++; | |
16 | }else if (s.charAt(i) == 'G') { | |
17 | G++; | |
18 | }else if (s.charAt(i) == 'T') { | |
19 | T++; | |
20 | } | |
21 | } | |
22 | - | PrintWriter out = new PrintWriter(new File("output.txt")); |
22 | + | PrintWriter out = new PrintWriter(args[1]); |
23 | out.print(A + " ");out.print(C + " ");out.print(G + " ");out.print(T); | |
24 | input.close(); | |
25 | out.close(); | |
26 | ||
27 | ||
28 | ||
29 | } | |
30 | } |