Submission #1227491


Source Code Expand

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AGC005STing
{
    class Program
    {
        static void Main(string[] args)
        {
            string X = Console.ReadLine();
            Stack<char> stack = new Stack<char>();

            foreach(var c in X)
            {
                if(c == 'T')
                {
                    if(stack.Count > 0 && stack.Peek() == 'S')
                    {
                        stack.Pop();
                    }
                    else
                    {
                        stack.Push(c);
                    }
                }
                else
                {
                    stack.Push(c);
                }
            }

            Console.WriteLine(stack.Count);
            
        }
    }
}

Submission Info

Submission Time
Task A - STring
User hogeki
Language C# (Mono 4.6.2.0)
Score 300
Code Size 894 Byte
Status AC
Exec Time 25 ms
Memory 13240 KB

Judge Result

Set Name Sample Subtask1 All
Score / Max Score 0 / 0 200 / 200 100 / 100
Status
AC × 3
AC × 9
AC × 13
Set Name Test Cases
Sample example0, example1, example2
Subtask1 example0, example1, example2, sub_corner0, sub_corner1, sub_corner2, sub_rand0, handmade0, handmade1
All corner0, corner1, corner2, example0, example1, example2, handmade0, handmade1, maxrand0, sub_corner0, sub_corner1, sub_corner2, sub_rand0
Case Name Status Exec Time Memory
corner0 AC 24 ms 12256 KB
corner1 AC 24 ms 10720 KB
corner2 AC 24 ms 9824 KB
example0 AC 21 ms 9172 KB
example1 AC 21 ms 9172 KB
example2 AC 21 ms 11220 KB
handmade0 AC 21 ms 9172 KB
handmade1 AC 21 ms 9172 KB
maxrand0 AC 25 ms 13240 KB
sub_corner0 AC 21 ms 9172 KB
sub_corner1 AC 21 ms 11220 KB
sub_corner2 AC 21 ms 9172 KB
sub_rand0 AC 21 ms 11220 KB