Здравейте,доста се измъчих с тази задача и накрая я докарах да работи поне за примерите които са дадени,както и за други които си измислих.И качвам я в проверката и Compile Error
Error: /tmp/tmpABzfvp/03titlesearch.cs(63,30): error CS1502: The best overloaded method match for string.Join(string, params string[])' has some invalid arguments /usr/lib/mono/4.5/mscorlib.dll (Location of the symbol related to previous error) /tmp/tmpABzfvp/03titlesearch.cs(63,35): error CS1503: Argument
#1’ cannot convert char' expression to type
string’
Error: /tmp/tmpABzfvp/03titlesearch.cs(63,30): error CS1502: The best overloaded method match for string.Join(string, params string[])' has some invalid arguments /usr/lib/mono/4.5/mscorlib.dll (Location of the symbol related to previous error) /tmp/tmpABzfvp/03titlesearch.cs(63,35): error CS1503: Argument
#1’ cannot convert char' expression to type
string’
Няколко пъти copy/paste и пак така. При мен работи,дори компилирах exe, работи на всякъде а в проверката Compile Error.
ето и кода
using System;
using System.Collections.Generic;
using System.Linq;
namespace Title_Search
{
internal class Program
{
static void Main(string[] args)
{
string word = Console.ReadLine();
string word2 =null;
char[] areaword = new char[word.Length];
for (int i = 0; i < word.Length; i++)
areaword[i] = word[i];
var list1 = areaword.ToList();
int n = int.Parse(Console.ReadLine());
int loop = 0;
int x = 0;
int j = 0;
string str = null;
string strno= "No such title found!";
List<string> result = new List<string>();
while (loop < n)
{
word2 = Console.ReadLine();
char[] areaword2 = new char[word2.Length];
for (int i = 0; i < word2.Length; i++)
areaword2[i] = word2[i];
var list2 = areaword2.ToList();
x = 0;
for ( int i = 0; i < list1.Count; i++)
{
for ( j = 0; j < list2.Count;)
{
if (list1[i] == list2[j])
{
list1.Remove(list1[i]);
list2.Remove(list2[j]);
x++;
}
else
j++;
}
}
char delim = ' ';
str = string.Join(delim, list1);
str = str.Replace(" ", "");
if (x > 1)
{
result.Add(str);
}
else
{
result.Add(strno);
}
loop++;
}
for (int i = 0; i < result.Count; i++)
{
Console.WriteLine(result[i]);
}
}
}
}