Advertisement
Guest User

Untitled

a guest
Oct 28th, 2016
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.39 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. int main()
  5. {
  6.     std::string str = "";
  7.    
  8.     std::getline(std::cin, str);
  9.  
  10.     for (int i = 0; i < str.length(); i++)
  11.     {
  12.         std::cout << str[i];
  13.         int cnt = 0;
  14.         while (str[i] == '.' && str[i + 1] == '.')
  15.         {
  16.             cnt++;
  17.             if (cnt > 2)
  18.                 i++;
  19.             else if (str[i] == '.')
  20.                 std::cout << str[i];
  21.         }
  22.     }
  23.  
  24.     std::cout << std::endl;
  25.  
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement