1 solutions

  • 0
    @ 2025-5-5 10:05:17
    #include<bits/stdc++.h>
    using namespace std;
    
    int main()
    {
    	string s;
    	cin>>s;
    	set<string> h; //使用set去重 
    	int cnt=0;
    	for(int i=0;i+2<s.size();i++)
    	{
    		string s1=s.substr(i,3);
    		if(s1[0]!=s1[1]&&s1[1]==s1[2]) //判断是否符合abb 
    		{
    			cnt++;
    			h.insert(s1);
    		}	
    	} 
    	cout<<cnt<<" "<<h.size();
    	return 0;
    }
    
    • 1

    Information

    ID
    1272
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    3
    Tags
    # Submissions
    25
    Accepted
    12
    Uploaded By