Skip to content

Instantly share code, notes, and snippets.

@ykzts
Created April 26, 2010 02:55
Show Gist options
  • Save ykzts/378927 to your computer and use it in GitHub Desktop.
Save ykzts/378927 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
def test(s):
ret = []
for line in s.split('\n'):
ret.append(line + line[-1::-1])
return '\n'.join(ret)
if __name__ == '__main__':
sample1="""12345
abcde"""
sample2="""#include <iostream>
int main(int argc, char* argv[]){
std::cout << \"Test Program\" << std::endl;
return 0;
}"""
sample3="""X X Y Y ZZZZZZZ
X X Y Y Z
X X Y Y Z
X Y Z
X X Y Z
X X Y Z
X X Y ZZZZZZZ"""
print sample1
print test(sample1)
print '--'
print sample2
print test(sample2)
print '--'
print sample3
print test(sample3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment