python-challange/02/counter.py

30 lines
558 B
Python
Raw Normal View History

2021-10-30 22:04:40 +00:00
from collections import Counter
from utils.Url import Url
def count_string():
with open('string.txt') as file:
string = file.read()
return Counter(string)
def get_lowest(counted_dict):
lowest_string = ''
for key in counted_dict:
if counted_dict[key] == 1:
lowest_string += key
return lowest_string
def main():
counted = count_string()
lowest_string = get_lowest(counted)
builder = Url()
builder.solution = lowest_string
print(builder.url)
if __name__ == '__main__':
main()