fork download
  1. #include <iostream>
  2. #include <cstring>
  3. using namespace std;
  4.  
  5. int main() {
  6. char s[100],s2[100],c;
  7. cin.getline(s,100);
  8. cin>>c;
  9.  
  10. int k=0, i=0;
  11. while(s[i]!='\0'){
  12. if(s[i]==c||s[i]==c-('a'-'A'))k++;
  13. i++;
  14. }
  15. cout<<k;
  16. return 0;
  17. }
  18.  
Success #stdin #stdout 0s 15232KB
stdin
Programming Principles 1
p
stdout
3