const C = hypotenuse_length(A, B);
area_triangle(A, B);
perimeter(A, B, C);
const myTrim = (str) => {
const splitN = str.split(/[\n]/g);
const pattern = /[.|,|!|?|"|'|:|”|“]/;
let repeatedInx = -1;
let count = 0;
for (const el of splitN) {
repeatedInx += 1;
if (pattern.test(el[el.length - 1])) {
count += 1;
continue;
}
if (count === 3) break;
count = 0;
}
return splitN.slice(count && repeatedInx - count).join('\n');
};
myTrim(`
abc
abe
cde
ace?
ved.
cvd.
`);
// 'ace?\nved.\ncvd.\n'