1 条题解

  • 0
    @ 2024-12-24 9:49:41

    C++ :

    #include <iostream>
    #include <string>
    using namespace std;
    
    int main(){
    	string str1,str2;
    	int i,pos,len1,len2;
    	while(true){
    		int cnt=0;
    		cin>>str1;
    		if(str1=="#") break;
    		cin>>str2;
    		len2=str2.length();
    		pos=str1.find(str2);
    		while(pos!=-1){
    			pos=str1.find(str2,pos+len2);
    			cnt++;
    		}
    		cout<<cnt<<endl;
    	} 
    }
    
    
    • 1

    信息

    ID
    1022
    时间
    1000ms
    内存
    128MiB
    难度
    (无)
    标签
    递交数
    0
    已通过
    0
    上传者