Created
November 19, 2020 12:32
-
-
Save internetova/37b9f8aa70888296a62fdc7cd966ab25 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Задание 4 | |
// Вывести на экран количество одинаковых слов в тексте. | |
void main() { | |
const text = ''' | |
She sells sea shells on the sea shore; | |
The shells that she sells are sea shells I'm sure. | |
So if she sells sea shells on the sea shore, | |
I'm sure that the shells are sea shore shells | |
'''; | |
final textList = text.split(' '); | |
final textSet = textList.toSet(); | |
print('Количество одинаковых слов ${textList.length - textSet.length}'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment