提交时间:2024-11-01 16:30:36
运行 ID: 54984
#include<iostream> #include<cstring> using namespace std; char a[33]; int main() { cin>>a; char s1[3]; char s2[4]; strncpy(s1, a+strlen(a)-2,2); strncpy(s2,a+strlen(a)-3,3); char s3[strlen(a)]; if((s1[0]=='e'&&s1[1]=='r')||(s1[0]=='l'&&s1[1]=='y')){ strncpy(s3,a,strlen(a)-2); cout<<s3; } else if((s2[0]=='i'&&s2[1]=='n'&&s2[2]=='g')){ strncpy(s3,a,strlen(a)-3); cout<<s3; } else{ cout<<a; } return 0; }