Submission #2386768
Source Code Expand
import java.util.Scanner; import java.util.Stack; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String x = sc.next(); Stack<String> stack = new Stack<>(); for(int i = 0 ; i < x.length() ; i++) { if(stack.size() > 0 && stack.peek().equals("S") && x.charAt(i) == 'T') { stack.pop(); } else { stack.add(String.valueOf(x.charAt(i))); } } System.out.println(stack.size()); } }
Submission Info
Submission Time | |
---|---|
Task | A - STring |
User | kouta1612 |
Language | Java8 (OpenJDK 1.8.0) |
Score | 300 |
Code Size | 474 Byte |
Status | AC |
Exec Time | 221 ms |
Memory | 38868 KB |
Judge Result
Set Name | Sample | Subtask1 | All | ||||||
---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 200 | 100 / 100 | ||||||
Status |
|
|
|
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 | 221 ms | 32040 KB |
corner1 | AC | 195 ms | 38868 KB |
corner2 | AC | 200 ms | 30312 KB |
example0 | AC | 90 ms | 19540 KB |
example1 | AC | 91 ms | 16848 KB |
example2 | AC | 89 ms | 19924 KB |
handmade0 | AC | 89 ms | 21844 KB |
handmade1 | AC | 88 ms | 19796 KB |
maxrand0 | AC | 214 ms | 26912 KB |
sub_corner0 | AC | 92 ms | 19796 KB |
sub_corner1 | AC | 92 ms | 16976 KB |
sub_corner2 | AC | 91 ms | 23124 KB |
sub_rand0 | AC | 92 ms | 19412 KB |