1 solutions

  • 0
    @ 2023-12-19 20:57:52
    #include <iostream>
    #include <string>
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
    	string lon,zao,re;
    	getline(cin,lon);
    	getline(cin,zao);
    	int len = lon.length();
    	int ret = 1;
    	int shu; 
    	int kai = 0;
    	int sum = 0;
    	
    	for(int i = 0 ;i < len ;i++){
    		if(lon[i] == ' '|| lon[i] == '.'){
    			re = lon.substr(kai,sum);
    			if(re == zao){
    				shu = ret;
    				break;
    			}
    			ret++;
    			kai = i+1;
    			sum = 0;
    		}else{
    			sum++;
    		}
    	}
    	cout << shu;
    	return 0;
    }
    
    • 1

    Information

    ID
    344
    Time
    1000ms
    Memory
    16MiB
    Difficulty
    5
    Tags
    # Submissions
    84
    Accepted
    35
    Uploaded By