C++:: 프로그래머스 < 문자열 다루기 기본 >

jahlee·2023년 8월 9일
0

프로그래머스_Lv.1

목록 보기
68/75
post-thumbnail

주어진 문제 조건에 맞추면 되는 간단한 문제이다.

#include <string>
#include <vector>

using namespace std;

bool solution(string s) {
    if (s.size() != 4 && s.size() != 6) return false;
    for (auto c : s) if (!isdigit(c)) return false;
    return true;
}

0개의 댓글