// 핸드폰 번호 가리기
#include <iostream>
#include <string>
using namespace std;
string solution(string phone_number) {
string str = phone_number;
for (int i = 0; i < str.length() - 4; i++) {
str[i] = '*';
}
return str;
}
int main() {
string a("01033334444");
cout << solution(a) << endl;
}
'[알고리즘] 문제풀이 연습' 카테고리의 다른 글
[프로그래머스] 자연수 뒤집어 배열로 만들기 (0) | 2019.11.03 |
---|---|
[프로그래머스] 자릿수 더하기 level 1 (0) | 2019.11.03 |
[C++] map 컨테이너 (0) | 2019.11.03 |
[c++] vector 컨테이너 사용법 (0) | 2019.11.02 |
[C++] string 클래스 정리, 문자열 다루기 (0) | 2019.11.02 |