| 6 | |
| 7 | #include<bits/stdc++.h> |
| 8 | class Solution { |
| 9 | public: |
| 10 | string defangIPaddr(string address) { |
| 11 | string op; |
| 12 | //A for loop which will execute till the address[i] which means the string runs till the last character of the string is Null |
| 13 | for(int i=0;address[i]!='\0';i++) |
| 14 | { |
| 15 | //if address[i]== '.' which means that if the in a string contains a period we'll replace it with [.] |
| 16 | if(address[i]=='.') |
| 17 | { |
| 18 | //This line adds the square brackets if there's a period in a string |
| 19 | op=op+'['+ address[i]+']'; |
| 20 | i++; |
| 21 | |
| 22 | } |
| 23 | op=op+address[i]; |
| 24 | |
| 25 | } |
| 26 | return op; |
| 27 | } |
| 28 | }; |
nothing calls this directly
no outgoing calls
no test coverage detected