输出和样例一摸一样,但进入IDE模式错了,交上去也是全wa,显示答案太短,怀疑是while(cin>>s)的错误,但不知道怎么改了
#include<bits/stdc++.h>
using namespace std;
const int N=5e5+10;
char a[N];
int n,cnt,top,cnt1,flag;
string s,s1;
int tot(int x)
{
if(x%3==1)return x/3;
if(x%3==2)return x/3+1;
if(x%3==0)return x/3;
}
int tot1(int x)
{
if(x*2%3==1)return x*2/3;
if(x*2%3==2)return x*2/3+1;
if(x*2%3==0)return x*2/3;
}
bool check(int x)
{
if((s1[x]>='a'&&s1[x]<='z')||(s1[x]>='A'&&s1[x]<='Z'))return 1;
return 0;
}
bool judge(int x)
{
if(s1[x]=='a'||s1[x]=='e'||s1[x]=='i'||s1[x]=='o'||s1[x]=='u'||s1[x]=='A'||s1[x]=='E'||s1[x]=='I'||s1[x]=='O'||s1[x]=='U')return 1;
return 0;
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
cin>>s;
s1=s;
while(cin>>s)s1+=" "+s;
for(int i=0;i<=s1.size();i++)
{
if(check(i))cout<<".",cnt++;
else cout<<s1[i];
}
cout<<endl;
cnt1=tot(cnt);
while(cnt1)
{
if(check(top))cnt1--;
cout<<s1[top];
top++;
}
for(int i=top;i<s1.size();i++)
{
if(check(i))cout<<".";
else cout<<s1[i];
}
cout<<endl;
for(int i=top;i<s1.size();i++)if(judge(i)){flag=1;break;}
top=0;
if(flag)
{
cnt1=cnt;
while(cnt1)
{
if(check(top))cnt1--;
cout<<s1[top];
top++;
}
for(int i=top;i<s1.size();i++)
{
if(check(i))cout<<".";
else cout<<s1[i];
}
for(int i=top;i<s1.size();i++)
{
if(judge(i))cout<<s1[i];
else if(check(i))cout<<".";
else cout<<s1[i];
}
}
else
{
cnt1=tot1(cnt);
while(cnt1)
{
if(check(top))cnt1--;
cout<<s1[top];
top++;
}
for(int i=top;i<s1.size();i++)
{
if(check(i))cout<<".",cnt++;
else cout<<s1[i];
}
}
return 0;
}