Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Ask questions, find answers and collaborate at work with Stack Overflow for Teams.
Ask questions, find answers and collaborate at work with Stack Overflow for Teams. Explore Teams
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
##Python 2, 48 bytes
lambda n:[s for s,t in zip(*[iter(n)]*2)if s!=t]
Try it online
Thanks to Dennis and vaultah for pointing out stuff that I missed
##Python 2, 5648 bytes
n=input();print[slambda n:[s for s,t in zip(n[::2],n[1::2]*[iter(n)]*2)if s!=t]
Try it onlineTry it online
There has to be a better wayThanks to get every 2 elementsDennis and vaultah for pointing out stuff that I'm missing...I missed
##Python 2, 56 bytes
n=input();print[s for s,t in zip(n[::2],n[1::2])if s!=t]
There has to be a better way to get every 2 elements that I'm missing...