웅재의 코딩세상

[프로그래머스] 핸드폰 번호 가리기 본문

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

[프로그래머스] 핸드폰 번호 가리기

웅드 2024. 2. 9. 17:10

 

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

using namespace std;

string solution(string phone_number) {
    string answer = "";
    answer = phone_number;
    for(int i=0; i<phone_number.size()-4; i++){
        answer[i] = '*';
    }
    return answer;
}
반응형