Submission #904303
Source Code Expand
import java.util.Scanner; public class Main { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { char[] X = sc.next().toCharArray(); int S = 0; int ans = 0; for (char c : X) { if (c == 'S') { ++S; } else { if (S > 0) { --S; } else { ++ans; } } } System.out.println(ans + S); } }
Submission Info
Submission Time | |
---|---|
Task | A - STring |
User | tomerun |
Language | Java8 (OpenJDK 1.8.0) |
Score | 300 |
Code Size | 392 Byte |
Status | AC |
Exec Time | 272 ms |
Memory | 15340 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 | 207 ms | 15340 KB |
corner1 | AC | 189 ms | 13976 KB |
corner2 | AC | 191 ms | 14796 KB |
example0 | AC | 124 ms | 9552 KB |
example1 | AC | 125 ms | 9680 KB |
example2 | AC | 272 ms | 9552 KB |
handmade0 | AC | 124 ms | 9552 KB |
handmade1 | AC | 123 ms | 9552 KB |
maxrand0 | AC | 189 ms | 14660 KB |
sub_corner0 | AC | 135 ms | 9552 KB |
sub_corner1 | AC | 135 ms | 9676 KB |
sub_corner2 | AC | 123 ms | 9552 KB |
sub_rand0 | AC | 135 ms | 9680 KB |