Skip to main content
Golfed 6 bytes
Source Link
DLosc
  • 40.7k
  • 6
  • 87
  • 142

Python 3Python 3.8, 8181 75 bytes

Thanks to Mukundan314 for 5 bytes and ovs for another 1 byte

importlambda re L=[*mapS:max(L:=[*map(len,re.findall("[A-Za"[a-z]+",input()S,2))] print(max(L,key=L.count)) import re 

Try it online!Try it online!

Anonymous function: Finds all runs of letters using regex, collects a list of the lengths of those runs, and prints the item with the maximum frequency in the list.

Python 3, 81 bytes

import re L=[*map(len,re.findall("[A-Za-z]+",input()))] print(max(L,key=L.count)) 

Try it online!

Finds all runs of letters using regex, collects a list of the lengths of those runs, and prints the item with the maximum frequency in the list.

Python 3.8, 81 75 bytes

Thanks to Mukundan314 for 5 bytes and ovs for another 1 byte

lambda S:max(L:=[*map(len,re.findall("[a-z]+",S,2))],key=L.count) import re 

Try it online!

Anonymous function: Finds all runs of letters using regex, collects a list of the lengths of those runs, and prints the item with the maximum frequency in the list.

Source Link
DLosc
  • 40.7k
  • 6
  • 87
  • 142

Python 3, 81 bytes

import re L=[*map(len,re.findall("[A-Za-z]+",input()))] print(max(L,key=L.count)) 

Try it online!

Finds all runs of letters using regex, collects a list of the lengths of those runs, and prints the item with the maximum frequency in the list.