#!/usr/bin/env python import sys import os import six def inc_text(s): if not s.startswith( '@' ): return None path = s[ 1: ] r = False if not os.path.exists( path ): return r with open( path, 'rb' ) as f: try: r = f.read().decode( 'utf-8' ) if r[ -1 ] == '\n': r = r[ : -1 ] except: pass return r def inc_exp(s, inc_text): def inc_exp_line(s): r = inc_text( s ) return s if r in ( None, False ) else inc_exp( r, inc_text ) return '\n'.join( map( inc_exp_line, s.split( '\n' ) ) ) if __name__ == "__main__": s = sys.stdin.read() s = inc_exp( s, inc_text ) f = sys.stdout if six.PY2 else sys.stdout.buffer f.write( s.encode( 'utf-8' ) ) # EOF