::public/코딩테스트 풀이

문자열 다루기 기본

해맑은욱 2019. 9. 5. 16:42
*문자열 다루기 기본 
문자열 s의 길이가 4혹은 6이고, 숫자로만 구성돼있는지 확인
 
#include <iostream>
#include <algorithm> 
 
using namespace std
 
bool solution(string s)  
{     
    for ( char c : s )  
        if ( isdigit(c) == false ) 
            return false
    } 
 
    if ( s.length() != 4 && s.length() != 6 ) 
        return false
cs