Submission #904458
Source Code Expand
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
#define MP make_pair
#define PB push_back
#define ff first
#define ss second
#define TR(it,c) for( typeof(c.begin()) it = c.begin(); it != c.end(); ++it )
#define TRR(it,c) for( typeof(c.rbegin()) it = c.rbegin(); it != c.rend(); ++it
#define REP(i,a) for (int i = 0; i < (a); i++)
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORD(i,a,b) for (int i = (a); i >= (b); i--)
#define DRI(a) int a; scanf("%d", &a);
#define DRII(a, b) int a, b; scanf("%d %d", &a, &b);
#define DRIII(a, b, c) int a, b, c; scanf("%d %d %d", &a, &b, &c);
#define RI(a) scanf("%d", &a);
#define RII(a, b) scanf("%d %d", &a, &b);
#define RIII(a, b, c) scanf("%d %d %d", &a, &b, &c);
#define MM(arr, num) memset((arr), (num), sizeof((arr)))
#define DEB(x) cerr << ">>> " << (#x) << " -> " << (x) << endl;
#define DEBA(x,n) cerr << (#x) << " "; deba((x),(n));
void deba(int * a, int n){ cerr << "| "; REP(i,n) cerr << a[i] << " "; cerr << "|" << endl;}
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
const int INF = 1<<30;
typedef long long ll;
typedef unsigned long long ull;
/*******************************************************/
char s[223456];
int main() {
scanf("%s",s);
int len = strlen(s);
stack<char> st;
st.push('a');
REP(i,len){
if(st.top() == 'S' && s[i] == 'T') st.pop();
else{ st.push(s[i]); }
}
cout << st.size() - 1 << endl;
return 0;
}
Submission Info
Submission Time
2016-10-01 21:04:52+0900
Task
A - STring
User
jamaisvu
Language
C++14 (GCC 5.4.1)
Score
300
Code Size
1812 Byte
Status
AC
Exec Time
4 ms
Memory
640 KB
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:53:16: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%s",s);
^
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
4 ms
512 KB
corner1
AC
4 ms
640 KB
corner2
AC
4 ms
512 KB
example0
AC
3 ms
256 KB
example1
AC
3 ms
256 KB
example2
AC
3 ms
256 KB
handmade0
AC
3 ms
256 KB
handmade1
AC
3 ms
256 KB
maxrand0
AC
4 ms
384 KB
sub_corner0
AC
3 ms
256 KB
sub_corner1
AC
3 ms
256 KB
sub_corner2
AC
3 ms
256 KB
sub_rand0
AC
3 ms
256 KB