본문 바로가기

코딩 테스트/프로그래머스

[Level 1, C++] 문자열 다루기 기본

728x90
반응형

#include <string>
#include <cstdlib>
using namespace std;

bool solution(string s) {
    if(s.length() == 4 || s.length() == 6) {
        if (s.length() == to_string(atoi(s.c_str())).length()) return true;
        else return false;
    }
    else return false;
    
}
728x90
반응형