Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- import java.io.*;
- class Question1 {
- public static void main(String[] args) throws IOException{
- int A = 0;
- int C = 0;
- int G = 0;
- int T = 0;
- Scanner input = new Scanner(new File(args[0]));
- String s = input.next();
- for (int i = 0; i < s.length(); i++) {
- if (s.charAt(i) == 'A') {
- A++;
- }else if (s.charAt(i) == 'C') {
- C++;
- }else if (s.charAt(i) == 'G') {
- G++;
- }else if (s.charAt(i) == 'T') {
- T++;
- }
- }
- PrintWriter out = new PrintWriter(args[1]);
- out.print(A + " ");out.print(C + " ");out.print(G + " ");out.print(T);
- input.close();
- out.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement