[c] миша
Viewer
*** This page was generated with the meta tag "noindex, nofollow". This happened because you selected this option before saving or the system detected it as spam. This means that this page will never get into the search engines and the search bot will not crawl it. There is nothing to worry about, you can still share it with anyone.
- #include <iostream>
- #include <sstream>
- using namespace std;
- bool
- rep (std::string str)
- {
- int count = 0;
- for (size_t i = 0; i < str.length (); i++)
- {
- size_t pos = str.rfind (str[i]);
- if (pos == i){
- count++;
- }
- }
- if (count == str.length ())
- {
- cout << "В слове " << str <<" нет повторений \n";
- return true;
- }
- else
- {
- return false;
- }
- }
- int
- main ()
- {
- string str, word;
- int size, count = 0;
- cout << "Введите текст для проверки слов: ";
- getline (cin, str);
- stringstream words (str);
- while (words >> word)
- {
- size = word.size ();
- if (rep (word))
- {
- count++;
- }
- }
- cout << "\nВ этом тексте было найдено " << count <<
- " слов(а) без повторяющихся букв." << endl;
- return 0;
- }
Editor
You can edit this paste and save as new: