Submission #150739

#TimeUsernameProblemLanguageResultExecution timeMemory
150739티셔츠 콜렉터 (#200)HicCup (FXCUP4_hiccup)C++17
0 / 100
6 ms384 KiB
#include "hiccup.h"
#include <stack>

std::stack<char> st;
int HicCup(std::string S) {
	int N = S.size();
	int res = 0;
	for (int i=0; i<N; i++) {
		if (S[i] == 'H') {
			st.push(S[i]);
		} else if (S[i] == 'C') {
			if (st.top() == 'H') {
				st.pop();
			} else {
				res = -1;
				break;
			}
		}
	}
	return res;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...