fork download
  1. #include <iostream>
  2. using namespace std;
  3. int ile(string s, char z) {
  4. int ile = 0;
  5. for (int i=0; i<s.size(); i++)
  6. if (s[i]==z)
  7. ile++;
  8. return ile;
  9. }
  10.  
  11. int main() {
  12. cout<<ile("CCATACAAAA", 'A')<<endl;
  13. cout<<ile("CCATACAAAA", 'C')<<endl;
  14. cout<<ile("CCATACAAAA", 'T')<<endl;
  15. cout<<ile("TCTAAAGATAtCGGG", 'T')<<endl;
  16. cout<<ile("TCTAAAGATAtCGGG", 'C')<<endl;
  17. cout<<ile("TCTAAAGATAtCGGG", 'A')<<endl;
  18. cout<<ile("TCTAAAGATAtCGGG", 'G')<<endl;
  19. return 0;
  20. }
Success #stdin #stdout 0.01s 5292KB
stdin
Standard input is empty
stdout
6
3
1
3
2
5
4