提交时间:2023-10-21 20:48:09

运行 ID: 29199

#include<bits/stdc++.h> using namespace std; bool in(char s[],char arr[]){ for(int i=0;i<strlen(s)-strlen(arr);i++){ bool flg=true; for(int j=strlen(arr)-1;j>=0;j--){ if(!(s[i+j]==arr[j])){ flg=false; break; } } if(flg)return true; } return false; } int main(){ char word[1000]; cin>>word; if(in(word,"er")||in(word,"ly")){ word[strlen(word)-1]=' '; word[strlen(word)-2]=' '; }else if(in(word,"ing")){ word[strlen(word)-1]=' '; word[strlen(word)-2]=' '; word[strlen(word)-3]=' '; } cout<<word; return 0; }