프로그래머스 - 문자열 다루기 기본

well-life-gm·2021년 11월 6일
0

프로그래머스

목록 보기
38/125

프로그래머스 - 문자열 다루기 기본

isdigit만 익혀두면 될 것 같다.

#include <string>
#include <vector>

using namespace std;

bool solution(string s) {
    int n = s.size();
    if(n != 4 && n != 6)
        return false;
    
    for(auto c : s) {
        if(isdigit(c))
            continue;
        return false;
    }
    
    return true;
}
profile
내가 보려고 만든 블로그

0개의 댓글