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. int main() {
  11. cout<< ile("CAATACAA", 'A')<<endl;
  12. cout<< ile("CAATACAA", 'C')<<endl;
  13. cout<< ile("CAATACAA", 'T')<<endl;
  14. cout<<ile("TCTAAAGATATCGGG", 'A')<<endl;
  15. cout<<ile("TCTAAAGATATCGGG", 'T')<<endl;
  16. cout<<ile("TCTAAAGATATCGGG", 'G')<<endl;
  17. return 0;
  18. }
Success #stdin #stdout 0.01s 5316KB
stdin
Standard input is empty
stdout
5
2
1
5
4
4