Submission #148707

#TimeUsernameProblemLanguageResultExecution timeMemory
148707HSNU (#200)HicCup (FXCUP4_hiccup)C++17
24 / 100
21 ms4352 KiB
#include<bits/stdc++.h>
#include "hiccup.h"

using namespace std;

int HicCup(string S)
{
	int N = S.size();

	stack<char> s;
	for (char c : S)
        if (s.empty())
            s.push(c);
        else if (s.top() == 'H' && c == 'C')
            s.pop();
        else
            s.push(c);

	return s.empty() - 1;
}

Compilation message (stderr)

hiccup.cpp: In function 'int HicCup(std::__cxx11::string)':
hiccup.cpp:8:6: warning: unused variable 'N' [-Wunused-variable]
  int N = S.size();
      ^
#Result Execution timeMemoryGrader output
Fetching results...
#Result Execution timeMemoryGrader output
Fetching results...