Submission #1160583


Source Code Expand

using System;
using System.Collections.Generic;

namespace agc005_a
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            Stack<char> stack = new Stack<char>();
            for (int i = 0; i < s.Length; i++)
            {
                if (s[i] == 'S')
                {
                    stack.Push('S');
                }
                else
                {
                    if (stack.Count == 0)
                    {
                        stack.Push('T');
                    }
                    else
                    {
                        if (stack.Peek() == 'S')
                        {
                            stack.Pop();
                        }
                        else
                        {
                            stack.Push('T');
                        }
                    }
                }
            }
            Console.WriteLine(stack.Count);
        }
    }
}

Submission Info

Submission Time
Task A - STring
User mencotton
Language C# (Mono 4.6.2.0)
Score 300
Code Size 1040 Byte
Status AC
Exec Time 26 ms
Memory 12768 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 25 ms 10208 KB
corner1 AC 26 ms 12768 KB
corner2 AC 26 ms 11872 KB
example0 AC 22 ms 9172 KB
example1 AC 23 ms 11220 KB
example2 AC 22 ms 9172 KB
handmade0 AC 22 ms 11220 KB
handmade1 AC 22 ms 11220 KB
maxrand0 AC 26 ms 11744 KB
sub_corner0 AC 22 ms 9172 KB
sub_corner1 AC 23 ms 11220 KB
sub_corner2 AC 23 ms 11220 KB
sub_rand0 AC 22 ms 9172 KB