Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <string>
- std::string::iterator function(std::string::const_iterator a, std::string::const_iterator b, std::string::iterator wyjscie)
- {
- while ((a + 1) != b)
- {
- if (*a == *(a + 1))
- {
- *wyjscie++ = *a;
- }
- else
- {
- *wyjscie = *a;
- *(wyjscie + 1) = *(a + 1);
- wyjscie += 2;
- }
- ++a;
- if ((a + 1) == b)
- {
- break;
- }
- ++a;
- }
- if ((b - a) % 2 == 1)
- {
- *wyjscie++ = *a;
- }
- return wyjscie;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement