2015-06-09 22:41:53 +02:00
|
|
|
from sys import argv, exit
|
|
|
|
|
|
|
|
class DefaultDict(dict):
|
|
|
|
def __init__(self,default):
|
|
|
|
super(DefaultDict, self).__init__()
|
|
|
|
self.default = default
|
|
|
|
|
|
|
|
def __getitem__(self, key):
|
|
|
|
return self.get(key, self.default)
|
|
|
|
|
2015-06-11 11:52:30 +02:00
|
|
|
if len(argv) <= 1:
|
|
|
|
print("%s <format>" % argv[0])
|
2015-06-09 22:41:53 +02:00
|
|
|
exit(1)
|
|
|
|
|
2015-06-11 11:52:30 +02:00
|
|
|
format_str = argv[1]
|
2015-06-09 22:41:53 +02:00
|
|
|
cache = DefaultDict("")
|
|
|
|
|
|
|
|
while True:
|
2015-06-11 11:52:30 +02:00
|
|
|
print(format_str % cache)
|
|
|
|
data = input().rstrip('\n').split(' ',1)
|
|
|
|
if len(data) < 2:
|
|
|
|
tag,content = data[0],""
|
|
|
|
else:
|
|
|
|
tag,content = data
|
2015-06-09 22:41:53 +02:00
|
|
|
cache[tag] = content
|