#include < bits/stdc++.h >
using namespace std;
int main() {
int t;
string s;
char ch;
scanf("%d ",&t);
while(t--) {
getline(cin , s);
scanf("%c ",&ch);
size_t n = count(s.begin(), s.end(), ch);
if(n > 0){
cout << "Occurrence of " << "'" << ch <<"'" << " in '"
<< s << "' = " << n << endl;
}else {
cout << "'" << ch << "' is not present" << endl;
}
}
return 0;
}
No comments:
Post a Comment