• Home
  • About
    • Jiwon Jeong photo

      Jiwon Jeong

      끊임없이 배우며 성장하는 엔지니어

    • Learn More
    • Email
    • Github
  • Posts
    • All Posts
    • All Tags
    • All Categories
  • Projects

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

13 May 2021

Reading time ~1 minute

풀이(성공)

#include <string>
#include <vector>

using namespace std;

string solution(string phone_number) {
    string answer = "";
    int index= phone_number.size()-4;
    string remain = phone_number.substr(index);
    for(int i=0; i<index; i++){
        answer += "*";
    }
    answer += remain;
    return answer;
}


PS Share Tweet +1