핸드폰 번호 가리기

magicdrill·2024년 3월 6일
0

핸드폰 번호 가리기

#include <string>
#include <vector>

using namespace std;

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

0개의 댓글