1108.IP 地址無效化
題目連結:https://leetcode.cn/problems/defanging-an-ip-address/description/
題解程式碼:
class Solution {
public:
string defangIPaddr(string address) {
string ans;
for(auto&c:address)
{
if(c == '.') ans+="[.]";
else ans+=c;
}
return ans;
}
};