-
-
Save amankharwal/11cf90a52c01e903105ef43596438d52 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
#include <bits/stdc++.h> | |
using namespace std; | |
string DefangIP(string str) | |
{ | |
string defangIP = ""; | |
for (char c : str) | |
(c == '.') ? defangIP += "[.]" : | |
defangIP += c; | |
return defangIP; | |
} | |
int main() | |
{ | |
string str; | |
cin>>str; | |
cout <<DefangIP(str); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment