Advertisement
aryobarzan

Codeforces 40-C

Mar 28th, 2011
1,267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.86 KB | None | 0 0
  1. #include <iostream>
  2. #include <algorithm>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.         string input;
  8.         cin>>input;
  9.         string made=input.substr(0,1);
  10.         bool at=false;
  11.         for(int i=1;i<input.length();)
  12.         {
  13.                 if(input.substr(i,3)=="dot"&&i+3!=input.length())
  14.                         {
  15.                                 made=made+".";
  16.                                 i+=3;
  17.                         }
  18.                 else if(input.substr(i,2)=="at"&&at==false&&i+2!=input.length())
  19.                 {
  20.                         at=true;
  21.                         made=made+"@";
  22.                         i+=2;
  23.                 }
  24.                 else
  25.                 {
  26.                         made=made+input.substr(i,1);
  27.                         i++;
  28.                 }
  29.         }
  30.         cout<<made<<endl;
  31.         return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement