Submission #912519


Source Code Expand

#include <iostream>
#include <string>
#include <stack>
using namespace std;

int main()
{
    string x; cin>>x;
    stack<char> s;

    for(e: x) {
        if (e=='T' and s.size() and s.top()=='S')
            s.pop();
        else
            s.push(e);
    }
    cout<<s.size()<<endl;
}
#include <iostream>
#include <string>
#include <stack>
using namespace std;

int main()
{
    string x; cin>>x;
    stack<char> s;

    for(e: x) {
        if (e=='T' and s.size() and s.top()=='S')
            s.pop();
        else
            s.push(e);
    }
    cout<<s.size()<<endl;
}

Submission Info

Submission Time
Task A - STring
User hogeover30
Language C++14 (GCC 5.4.1)
Score 0
Code Size 614 Byte
Status CE

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:11:8: warning: range-based for loop without a type-specifier only available with -std=c++1z or -std=gnu++1z
     for(e: x) {
        ^
./Main.cpp: In function ‘int main()’:
./Main.cpp:24:5: error: redefinition of ‘int main()’
 int main()
     ^
./Main.cpp:6:5: note: ‘int main()’ previously defined here
 int main()
     ^
./Main.cpp:29:8: warning: range-based for loop without a type-specifier only available with -std=c++1z or -std=gnu++1z
     for(e: x) {
        ^