1 solutions

  • 0
    @ 2025-3-3 16:32:53

    C++ :

    #include <bits/stdc++.h>
    using namespace std;
    
    int main(){
    	string s1,s2;
    	int c = 0;
    	getline(cin,s1);
    	getline(cin,s2);
    	while(s2.find(s1) != -1){
    		s2.replace(s2.find(s1),s1.size(),"");
    		c++;
    	}
    	cout<<c<<endl;
    }
    
    
    

    Python :

    a = input()
    b = input()
    print(b.count(a))
    
    
    • 1

    Information

    ID
    10473
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By