Answer the question
In order to leave comments, you need to log in
What algorithms for identifying patterns exist?
And what kinds of regularities are there?
Answer the question
In order to leave comments, you need to log in
Abstraction
Approximation
Modeling
Interpolation
Extrapolation
Oka's approximation theorem
You can, as dimonchik2013 suggested, or you can really use a split and just use a dictionary, set is only needed to work out the case when you need to sort out the lexicographic order.
#!/usr/bin/env python3
counts = dict()
with open('input.txt', 'rt') as fin:
for line in fin:
for word in line.split():
counts[word] = counts.get(word, 0) + 1
max = 0
max_word = set()
for word, cnt in counts.items():
if cnt > max:
max_word = {word}
max = cnt
if cnt == max:
max_word.add(word)
with open('output.txt', 'wt') as fout:
fout.write(min(max_word))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question