Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string = input()
- def scan_pairs(to_scan):
- pairs = list()
- for i in range(len(to_scan)):
- if i < len(to_scan)-1:
- if ' ' not in to_scan[i] and ' ' not in to_scan[i+1]:
- pairs.append(to_scan[i]+to_scan[i+1])
- return pairs
- def most_common(to_scan):
- pairs = scan_pairs(to_scan)
- count = 0
- m_count = 0
- the_pair = ""
- for i in range(len(pairs)):
- current_pair = pairs[i]
- for j in range(len(pairs)):
- if current_pair == pairs[j]:
- count += 1
- if count >= m_count:
- m_count = count
- the_pair = current_pair
- count = 0
- return the_pair
- print(most_common(string))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement