2 solutions

  • 0
    @ 2024-12-1 16:10:19
    #include<bits/stdc++.h> 
    using namespace std; 
    int main()
    { 
    	string s; 
    	cin>>s;
    	if(s[s.size()-2]=='e'&&s[s.size()-1]=='r'||s[s.size()-2]=='l'&&s[s.size()-1]=='y')
    	{
    		s.erase(s.size()-2,2);
    	}
    	else if(s[s.size()-3]=='i'&&s[s.size()-2]=='n'&&s[s.size()-1]=='g')
    	{
    		s.erase(s.size()-3,3);
    	}
    	cout<<s;
    	return 0;
    }
    • 0
      @ 2024-9-4 20:42:56

      #include<bits/stdc++.h> using namespace std; int main(){ string s; cin>>s; if(s[s.size()-1]'r'&&s[s.size()-2]'e'||s[s.size()-2]'l'&&s[s.size()-1]'y')s.erase(s.size()-2,2); else if(s[s.size()-3]'i'&&s[s.size()-2]'n'&&s[s.size()-1]=='g')s.erase(s.size()-3,3); cout<<s;

      return 0;
      

      }

      • 1

      Information

      ID
      927
      Time
      1000ms
      Memory
      256MiB
      Difficulty
      1
      Tags
      (None)
      # Submissions
      41
      Accepted
      18
      Uploaded By