-
-
Save llimllib/6954867 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The five boxing wizards jump quickly. | |
Pack my box with five dozen liquor jugs. | |
Pack my box with five dozen liquor jugs. | |
Pack my box with five dozen liquor jugs. | |
Pack my box with five dozen liquor jugs. | |
A quick brown fox jumps over the lazy dog. | |
The quick brown fox jumps over the lazy dog. | |
Pack my red box with five dozen quality jugs. | |
Pack my red box with five dozen quality jugs. | |
The quick brown fox jumped over the lazy dogs. | |
Who packed five dozen old quart jugs in my box? | |
Who packed five dozen old quart jugs in my box? | |
Who packed five dozen old quart jugs in my box? | |
My girl wove six dozen plaid jackets before she quit. | |
Few black taxis drive up major roads on quiet hazy nights. | |
A quick movement of the enemy will jeopardize six gunboats. | |
Who packed five dozen old quart jugs in my box? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
lines = sys.stdin.readlines() | |
last_line = None | |
for line in lines: | |
if line != last_line: | |
sys.stdout.write(line) | |
last_line = line |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from itertools import tee, izip | |
def pairs(iterable): | |
"s -> (s0,s1), (s1,s2), (s2, s3), ..." | |
a, b = tee(iterable) | |
next(b, None) | |
return izip(a, b) | |
import sys | |
lines = sys.stdin.readlines() | |
sys.stdout.write(lines[0]) | |
for a,b in pairs(lines): | |
if a != b: | |
sys.stdout.write(b) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment