数组
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;
}
};