본문 바로가기
👩‍💻Developer/Leetcode

[Easy][Python] Defanging an IP Address

by 블루누들 2022. 10. 23.

string형태의 IP address가 주어졌을 때 defanged version을 return한다.

(defanged version => replace very "." with "[.]")

 

class Solution:
    def defangIPaddr(self, address: str) -> str:
        return '[.]'.join(address.split('.'))

댓글