Submission #3404972


Source Code Expand

using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
class Program
{
	static void Main()
	{
		string s = Console.ReadLine();
		long countA = 0;
    long countB = 0;
    long countC = 0;
    bool answer = true;
    long maxCount = 0;
    long minCount = 0;

    for(long i = 0; i < s.Length; i++)
    {
      if(s[i] == 'a') countA++;
      if(s[i] == 'b') countB++;
      if(s[i] == 'c') countC++;
    }

    if(countA == 0)
    {
      if(countB > 1 || countC > 1) answer = false;
    }
    if(countB == 0)
    {
      if(countA > 1 || countC > 1) answer = false;
    }
    if(countC == 0)
    {
      if(countB > 1 || countA > 1) answer = false;
    }
    if(countA>0 && countB>0 && countC>0)
    {
      maxCount = Math.Max(countA,countB);
      maxCount = Math.Max(maxCount,countC);
      minCount = Math.Min(countA,countB);
      minCount = Math.Min(maxCount,countC);
      if(maxCount - minCount > 1) answer = false;
    }

    Console.WriteLine((answer) ? "YES" : "NO");
	}
}

Submission Info

Submission Time
Task B - Palindrome-phobia
User suikameron
Language C# (Mono 4.6.2.0)
Score 0
Code Size 1061 Byte
Status CE

Compile Error

./Main.cs(18,11): error CS1502: The best overloaded method match for `string.this[int]' has some invalid arguments
/usr/lib/mono/4.5/mscorlib.dll (Location of the symbol related to previous error)
./Main.cs(18,12): error CS1503: Argument `#1' cannot convert `long' expression to type `int'
./Main.cs(19,11): error CS1502: The best overloaded method match for `string.this[int]' has some invalid arguments
/usr/lib/mono/4.5/mscorlib.dll (Location of the symbol related to previous error)
./Main.cs(19,12): error CS1503: Argument `#1' cannot convert `long' expression to type `int'
./Main.cs(20,11): error CS1502: The best overloaded method match for `string.this[int]' has some invalid arguments
/usr/lib/mono/4.5/mscorlib.dll (Location of the symbol related to previous error)
./Main.cs(20,12): error CS1503: Argument `#1' cannot convert `long' expression to type `int'