Skip to content

Instantly share code, notes, and snippets.

@internetova
Created November 19, 2020 12:32
Show Gist options
  • Save internetova/37b9f8aa70888296a62fdc7cd966ab25 to your computer and use it in GitHub Desktop.
Save internetova/37b9f8aa70888296a62fdc7cd966ab25 to your computer and use it in GitHub Desktop.
// Задание 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