using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PelindromeIdentifier
{
class Program
{
static void Main()
{
int nNumberOfTestCases = 0;
int.TryParse(Console.ReadLine(), out nNumberOfTestCases);
String[] strTestCases = new String[nNumberOfTestCases];
char[] arrChar;
int nCharCount = 0;
bool bAllow = false;
int nCharIndex = 0;
for (int nTestCase = 0; nTestCase < nNumberOfTestCases; nTestCase++)
{
strTestCases[nTestCase] = Console.ReadLine();
}
for (int nTestCase = 0; nTestCase < nNumberOfTestCases; nTestCase++)
{
bAllow = false;
arrChar = strTestCases[nTestCase].Distinct().ToArray();
for (nCharIndex = 0; nCharIndex < arrChar.Length; nCharIndex++)
{
nCharCount = strTestCases[nTestCase].Count(i => i.Equals(arrChar[nCharIndex]));
if (strTestCases[nTestCase].Length % 2 == 0)
{
if (nCharCount % 2 != 0)
{
Console.WriteLine("NO");
break;
}
}
else
{
if (nCharCount % 2 != 0)
{
if (bAllow == true)
{
Console.WriteLine("NO");
break;
}
bAllow = true;
}
}
}
if (nCharIndex == arrChar.Length)
{`
Console.WriteLine("YES");
}
}
}
}
}
私はこれを試しましたが、入力文字列を取りたいとすべての文字列のためには、文字列が回文かどうかを返しますWAPは、文字列が回文かどうかをC#で確認します。
可能重複9790749 /文字列であるかどうかを確認する文字列 – Xavave
可能なテストケースを手助けするだけです –
隠されたテストケース?真剣に? – Sefe