Помощ с Judge C++ Advanced Exam Preparation
01. Letters ми дава 0 точки въпреки че zero Test-та минава
Може ли някакъв съвет?
https://judge.softuni.org/Contests/Practice/Index/3037#0
Ето и кода.
#include <iostream>
#include <stack>
#include <string>
#include <sstream>
#include <cctype>
#include <queue>
#include <map>
#include <list>
#include <set>
using namespace std;
int main()
{
string input;
getline(cin, input);
istringstream istr(input);
set<string> text;
while (istr >> input)
{
if (input.find('.') < input.length())
{
input.pop_back();
}
text.insert(input);
}
vector<char>characters;
char symbol;
while (true)
{
cin >> symbol;
if (symbol == '.')
{
break;
}
characters.push_back(symbol);
}
for (int c = 0; c < characters.size(); c++)
{
bool HasAny = false;
for (auto i = text.begin(); i != text.end(); i++)
{
string curWord = *i;
if (curWord.find(tolower(characters[c]))<curWord.length() || curWord.find(toupper(characters[c]))<curWord.length())
{
cout << curWord << " ";
}
}
if (HasAny)
{
cout << endl;
}
else
{
cout << "---";
}
}
return 0;
}
/*
You are given a text in English. Let’s define a word as any sequence of alphabetical characters. Each of those characters we’ll call a letter, but we will consider the uppercase and lowercase variant of a character in a word as the same letter.
a
Y
h
.
*/