+ 3

Remove duplicate words from string

I shall remove duplicate words in the string given with a few conditions (from original task): "leaving only single (first) words entries. By word we shall mean the unit that consists only of latin alphabet characters. Only following punctuation marks (. , ! ? - : ; ) and space characters can be delimiters between words". The solution would be presented without using LINQ. Ive implemented two algorithms wasnt work right: 1) based clearly on char iteration and string.Replace(); 2) Replace() + regex. I just have idea 😞

4th Jul 2019, 5:39 PM
universeawaits
universeawaits - avatar
5 Respostas
+ 4
Well, it became much easier to solve just ive posted this 🧐. The solution is the following code: https://code.sololearn.com/cahthLpb0lEF/?ref=app
5th Jul 2019, 5:46 AM
universeawaits
universeawaits - avatar
+ 4
sneeze you remarks are welcome ☺️
5th Jul 2019, 5:47 AM
universeawaits
universeawaits - avatar
+ 4
Well done. This totally meets the requirements. One thing that can be improved. At the moment some how the word "big" is replaces with " " (3 spaces) Have not been able to address where this goes wrong. Because you do replace big with "" (no spaces) in the function Simply remove every second space Or have a look why the 3 spaces are there
5th Jul 2019, 9:21 PM
sneeze
sneeze - avatar
+ 4
sneeze ok, thanks ☺️
5th Jul 2019, 9:26 PM
universeawaits
universeawaits - avatar
+ 3
Please share the code you already have made. Please use the playground. What do you mean with "wasnt work right" It was not accepted by the teacher or the result did not meet the requirements ?
4th Jul 2019, 7:38 PM
sneeze
sneeze - avatar