프로그래머스 레벨2 스트링 비교 문제

 

맨앞이 "("이고 맨뒤가 ")"로 끝나는 string인지 확인하는 문제

1
2
3
4
5
6
7
8
9
10
11
12
13
string s;
= ")()()()()(()((";
 
string strFront, strBack;
strFront = s.front();
strBack = s.back();
 
if (strFront.compare("("== 0 && strBack.compare(")"== 0)
 return true;
else
 return false;
 
 
 

 

+ Recent posts