defanging专题

1108. Defanging an IP Address

class Solution {public:string defangIPaddr(string add) {string res;for(auto x: add){if(x =='.') res += "[.]";else res += x;}return res;}};