<?php
$text = "вперед!назад!бегом!";
// Для тестов
//$text = 'roses are red,and violets are blue.whatever you do i\'ll keep it for you.';
// $text = 'привет.есть 2 функции,preg_split и explode ,не понимаю,в чем между ними разница.';
/* Делает первую букву в строке заглавной */
function makeFirstLetterUppercase($text) {
}
/* исправляет текст */
function fixText($text) {
$sep = ".";
$regexp="/\s*(\,|\.|\!|\?)([А-ЯЁа-яё]|[A-Za-z])/u";
foreach($arr as &$value){
$value = makeFirstLetterUppercase($value);
}
}
$result = fixText($text);
echo "{$result}\n";
PD9waHAgCgplcnJvcl9yZXBvcnRpbmcoLTEpOwptYl9pbnRlcm5hbF9lbmNvZGluZygidXRmLTgiKTsKCiR0ZXh0ID0gItCy0L/QtdGA0LXQtCHQvdCw0LfQsNC0IdCx0LXQs9C+0LwhIjsKLy8g0JTQu9GPINGC0LXRgdGC0L7QsgovLyR0ZXh0ID0gJ3Jvc2VzIGFyZSByZWQsYW5kIHZpb2xldHMgYXJlIGJsdWUud2hhdGV2ZXIgeW91IGRvIGlcJ2xsIGtlZXAgaXQgZm9yIHlvdS4nOwovLyAkdGV4dCA9ICfQv9GA0LjQstC10YIu0LXRgdGC0YwgMiDRhNGD0L3QutGG0LjQuCxwcmVnX3NwbGl0INC4IGV4cGxvZGUgLNC90LUg0L/QvtC90LjQvNCw0Y4s0LIg0YfQtdC8INC80LXQttC00YMg0L3QuNC80Lgg0YDQsNC30L3QuNGG0LAuJzsKIAovKiDQlNC10LvQsNC10YIg0L/QtdGA0LLRg9GOINCx0YPQutCy0YMg0LIg0YHRgtGA0L7QutC1INC30LDQs9C70LDQstC90L7QuSAqLwpmdW5jdGlvbiBtYWtlRmlyc3RMZXR0ZXJVcHBlcmNhc2UoJHRleHQpIHsKJHRleHQ9dHJpbSgkdGV4dCk7CnJldHVybiBtYl9zdHJ0b3VwcGVyKG1iX3N1YnN0cigkdGV4dCwgMCwgMSkpLm1iX3N1YnN0cigkdGV4dCwxLG1iX3N0cmxlbigkdGV4dCkpOwp9C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