leetcode

Solution to some Leetcode problems written in C++
git clone git://git.dimitrijedobrota.com/leetcode.git
Log | Files | Refs | README | LICENSE

1108.cpp (281B)


      1 class Solution {
      2   public:
      3     string defangIPaddr(const string &address) const {
      4         string res;
      5 
      6         for (const char c : address) {
      7             if (c != '.')
      8                 res += c;
      9             else
     10                 res += "[.]";
     11         }
     12 
     13         return res;
     14     }
     15 };