【字符串】1108. IP 地址无效化
作者:互联网
题目:
解法:
1 class Solution { 2 public: 3 string defangIPaddr(string address) 4 { 5 string res ; 6 7 for ( char c : address ) 8 { 9 if ( c == '.' ) 10 { 11 res += "[.]" ; 12 } 13 else 14 { 15 res += c ; 16 } 17 } 18 19 return res ; 20 } 21 };
标签:res,string,IP,char,address,字符串,defangIPaddr,1108,21 来源: https://www.cnblogs.com/ocpc/p/12824397.html