class Solution(object):
def numberOfLines(self, widths, S):
"""
:type widths: List[int]
:type S: str
:rtype: List[int]
"""
L =len(S)
wides = 0
n = 1
for i in range(L):
wides += widths[ord(S[i]) - 97]
while wides > 100:
wides = widths[ord(S[i]) - 97]
n += 1
return [n, wides]