The end character of the PHP string word is case-insensitive and the end character is case-insensitive. The end character of a PHP string is case-insensitive. The End character of the string must be case-insensitive. a string such as Ajourneyof, athousandmilesmustcantbeginwithasinglestep must be provided. The End character of a PHP string is case-insensitive.
Requirements
Returns A string such as "a journey of, a thousand 'Miles 'must can't \" begin \ "with A single step. ", which is changed to" a journeY oF, A thousanD 'mys' musT can't "begiN" witH A singlE steP through the PHP program."
Note:
1. if the last character of each word is in uppercase, it becomes in lowercase. if it is in lowercase, it becomes in uppercase.
2. you need to consider conversion in the form similar to can't.
3. punctuation marks (only consider, '".;) do not change.
Reference algorithm
Test
" . $str1 . "
result:
" . convertLastChar($str1) . "
"; echo "source:
" . $str2 . "
result:
" . convertLastChar($str2) . "
"; echo "source:
" . $str3 . "
result:
" . convertLastChar($str3) . "
"; echo "source:
" . $str4 . "
result:
" . convertLastChar($str4) . "
"; echo "source:
" . $str5 . "
result:
" . convertLastChar($str5) . "
"; echo "source:
" . $str6 . "
result:
" . convertLastChar($str6) . "
";?>
Result:
source:A journey of, a thousand 'miles' must can't "begin" with a single step.result:a journeY oF, A thousanD 'mileS' musT can'T "begiN" witH A singlE steP.source:A journey of, a thousand 'miles' must can't "begin" with a single step. result:a journeY oF, A thousanD 'mileS' musT can'T "begiN" witH A singlE steP. source:A journey of, a thousand 'miles' must can't "begin" with a single step. a result:a journeY oF, A thousanD 'mileS' musT can'T "begiN" witH A singlE steP. A source:A journey of, a thousand 'miles' must can't "begin" with a single step. a Bresult:a journeY oF, A thousanD 'mileS' musT can'T "begiN" witH A singlE steP. A bsource:A journey of, a thousand 'miles' must can't "begin" with a single step. a b'result:a journeY oF, A thousanD 'mileS' musT can'T "begiN" witH A singlE steP. A B'source:A journey of, a thousand 'miles' must can't "begin" with a single step. a B"result:a journeY oF, A thousanD 'mileS' musT can'T "begiN" witH A singlE steP. A b"
We can see that it is as expected.
Question source
Http://blog.sijiaomao.com /? P = 98. if there is a change (with the added can't), according to the changed rule, the original answer is all wrong.
Token requires that A string such as a journey of, a thousand 'Miles 'must can't \ "begin \" with A single step .., through PH...