27 lines
547 B
Python
27 lines
547 B
Python
import sys
|
|
import typing
|
|
|
|
|
|
def main() -> int:
|
|
counts_sum = sum([c for c in _iter_group_counts(sys.stdin)])
|
|
print(f"counts_sum={counts_sum}")
|
|
|
|
return 0
|
|
|
|
|
|
def _iter_group_counts(instream: typing.TextIO) -> typing.Generator[int, None, None]:
|
|
cur_group = set()
|
|
for line in instream:
|
|
line = line.strip()
|
|
if line == "":
|
|
yield len(cur_group)
|
|
cur_group = set()
|
|
for c in list(line):
|
|
cur_group.add(c)
|
|
|
|
yield len(cur_group)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main())
|