您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

3 年前
12345678910111213
  1. def main():
  2. with open("input6.txt") as file:
  3. text = file.read()
  4. groups = text.split("\n\n")
  5. print(f"I have {len(groups)} groups.")
  6. count = 0
  7. for grp in groups:
  8. sgrp = set(grp.replace("\n", ""))
  9. count += len(sgrp)
  10. print(f"The total is {count}.")
  11. if __name__ == "__main__":
  12. main()