输出格式错误
  • 板块灌水区
  • 楼主rish
  • 当前回复0
  • 已保存回复0
  • 发布时间2024/3/2 22:10
  • 上次更新2024/3/3 09:55:19
查看原帖
输出格式错误
257173
rish楼主2024/3/2 22:10

UVA10815 这样写为什么会报“Your program successfully solved the problem, but the output is not correctly formatted. Please check the output format specification and submit again.” 应该怎么改?

#include <bits/stdc++.h>
using namespace std;
int main()
{
	set<string> a;
	string x;
	while(cin >> x)
	{
		string s;
		for(int i=0;i<x.size();i++)
		{
			if(x[i]>='A'&&x[i]<='Z') s = s+char(x[i]-('A'-'a'));
			else if(x[i]>='a'&&x[i]<='z') s+=x[i];
			else if(s!="") 
			{
				a.insert(s);s="";continue;
			}
		}
		a.insert(s);
	}
	for(auto it = a.begin();it!=a.end();it++)
		cout << *it << endl;
	return 0;
}
2024/3/2 22:10
加载中...