문제풀이:
#include <string>
#include <vector>
using namespace std;
int solution(string my_string) {
int answer = 0;
for(char c: my_string)
{
if(c>='0'&& c<='9')
{
c-='0';
answer+=c;
}
}
return answer;
}
'코딩테스트' 카테고리의 다른 글
프로그래머스_0단계_ad 제거하기_C++ (0) | 2024.04.11 |
---|---|
프로그래머스_0단계_공백으로 구분하기 1C++ (0) | 2024.04.11 |
프로그래머스_0단계_문자열 정렬하기 (1)C++ (0) | 2024.04.11 |
프로그래머스_0단계_뒤에서 5등까지C++ (0) | 2024.04.11 |
프로그래머스_0단계_0떼기_C++ (0) | 2024.04.11 |