Advertisement
Eksekk

K01A

Jun 25th, 2021
740
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.57 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. typedef std::string::iterator iter;
  4. typedef std::string::const_iterator citer;
  5.  
  6. iter function(citer a, citer b, iter wyjscie)
  7. {
  8.     citer aplus = a + 1;
  9.     int dodane = 0;
  10.     int rozm = b - a;
  11.     while (aplus != b)
  12.     {
  13.         *wyjscie = *aplus;
  14.         *(wyjscie + 1) = *a;
  15.         dodane += 2;
  16.         wyjscie += 2;
  17.         ++a;
  18.         ++aplus;
  19.         if (aplus == b)
  20.         {
  21.             break;
  22.         }
  23.         ++a;
  24.         ++aplus;
  25.     }
  26.     if (dodane != rozm)
  27.     {
  28.         *wyjscie++ = *a;
  29.     }
  30.     return wyjscie;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement