Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(input) {
- "use strict";
- let text = input[0];
- text = text.replace(/[.,!?:;]\s*/g, (match) => match.trim() + " ");
- text = text.replace(/\s+[.,!?:;]/g, (match) => match.trim());
- text = text.replace(/\.\s*\.\s*\.\s*\!/g, "...!");
- text = text.replace(/(\.\s+)(\d+)/g,(match, gr1, gr2) => gr1.trim() + gr2);
- text = text.replace(/\"([^\"]+)\"/g, (match, gr1) => `"${gr1.trim()}"`);
- console.log(text);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement