1 solutions

  • 0
    @ 2025-11-5 18:32:29

    C++ :

    #include <iostream>
    #include <cstdio>
    #include <cstring>
    using namespace std;
    const int N = 10010;
    char ch[N];
    int main()
    {
        string s;
        getline(cin , s);
        int l = s.size();
        //strcmp相等为0,前一个大返回值大于0,里面可以放数组名字(因为是地址)
        if(strcmp(&s[l-3],"ing") == 0) l -= 3;
        else if(strcmp(&s[l-2],"er") == 0 || strcmp(&s[l-2],"ly") == 0) l -= 2;
        for (int i = 0; i < l; ++i) cout << s[i] ;
    
        return 0;
    }
    
    • 1

    Information

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