공부기록/프로그래머스
[프로그래머스] 핸드폰 번호 가리기
메델
2023. 8. 17. 14:15
class Solution {
public String solution(String phone_number) {
String answer = "";
StringBuilder sb = new StringBuilder();
for(int i=0; i< phone_number.length()-4; i++){
sb.append("*");
}
sb.append(phone_number.substring(phone_number.length()-4));
answer = sb.toString();
return answer;
}
}