코딩테스트/프로그래머스 - LV 1

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

웅드 2024. 2. 9. 17:23

 

  • 풀이
#include <string>
#include <vector>

using namespace std;

bool solution(string s) {
    bool answer = false;
    int check=0;
    if(s.length()==4 || s.length() == 6){
        for(int i=0; i<s.length(); i++){
            if(s[i]< 65) check++;
        }
    }
    return s.length() == check ? answer = true : answer = false;
}
반응형