//url:https://leetcode.com/problems/number-of-lines-to-write-string/description/
class Solution {
public:
vector numberOfLines(vector& widths, string S) {
vector result;
int totalLine=0;
int totalLength=0;
for(int i=0;i100){
totalLine++;
totalLength=0;
}
totalLength+=widths[S[i]-'a'];
}
if(totalLength>0){
totalLine++;
}
result.push_back(totalLine);
result.push_back(totalLength);
return result;
}
};