1 solutions

  • 0
    @ 2025-3-3 16:25:49

    C++ :

    #include <iostream>
    using namespace std;
    
    string s,t;
    int main(){
    	getline(cin,s);
    	getline(cin,t);
    	
    	if(s.find(t) == -1){
    		cout<<-1;
    		return 0;
    	}
    	
    	int p = 0;
    	p = s.find(t,p);
    	while(p != -1){
    		cout<<p+1<<endl;
    		p = s.find(t,p + 1);
    		
    	}
    	
    	return 0;
    }
    
    
    
    • 1

    Information

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