# 7-77 敲笨钟 (20分)难点剖析附测试点

5
xun zhang zhai ju lao diao chong, xiao yue dang lian gua yu gong.
tian sheng wo cai bi you yong, qian jin san jin huan fu lai.
xue zhui rou zhi leng wei rong, an xiao chen jing shu wei long.
zuo ye xing chen zuo ye feng, hua lou xi pan gui tang dong.
ren xian gui hua luo, ye jing chun shan kong.

xun zhang zhai ju lao diao chong, xiao yue dang lian qiao ben zhong.
Skipped
xue zhui rou zhi leng wei rong, an xiao chen jing qiao ben zhong.
Skipped
Skipped

#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
getchar(); //吃空格
while(n--)
{
string s;
getline(cin,s); //读入一行
int a = s.find(',');  //记录，号的位置
int b = s.find('.');  //记录.的位置
if(a<3||(s.substr(a-3,3)!="ong"||s.substr(b-3,3)!="ong"))
//由题意：a必须>=3，且每一句的最后必须同时压ong的韵才可以修改！
//不满足其中一个都输出skipped
{
cout<<"Skipped"<<endl;
continue;
}
else{
int sum=0,k=0;
for(int i=s.size()-1; sum != 3; i--)//找出倒数第三个空格的位置
{
if(s[i]==' ') sum++;
k=i;
}
s.replace(k+1, s.size()-k,"qiao ben zhong."); //k+1就是 q的位置 开始替换
}
cout<<s<<endl;
}
return 0;
}


©️2019 CSDN 皮肤主题: 游动-白 设计师: 上身试试