Problem 1: Counting DNA Nucleotides

Easy

A DNA string is a sequence composed of the symbols 'A', 'C', 'G', and 'T'. Given a DNA string, your task is to count how many times each nucleotide appears in the string. You should write a code on your PC, run it with the provided input, and then paste your results here and click on submit.

Sample Input:

AGCTTCGA

Sample Output:

A: 2, C: 2, G: 2, T: 2

Constraints:

The DNA string will contain at most 1,000,000 nucleotides.

Explanation:

In the sample input, the DNA string "AGCTTCGA" contains:

  • 2 occurrences of 'A'
  • 2 occurrences of 'C'
  • 2 occurrences of 'G'
  • 2 occurrences of 'T'

Your task is to count the occurrences of each nucleotide and print them in the format shown in the sample output.

Post a Comment

0Comments

Post a Comment (0)

#buttons=(Ok, Go it!) #days=(20)

Our app uses cookies to enhance your experience. Check Now
Ok, Go it!