https://pastein.ru/t/lK

  скопируйте уникальную ссылку для отправки


#include <iostream>
#include <sstream>
#include <vector>

using namespace std;

int main()
{
	setlocale(LC_ALL, "Russian");

	string input = "test lox loshka kapusta monitor sobaka koshka nudes";

	vector<string> words;
	stringstream x;
	x << input;

	while (!x.eof()) {
		string substring;
		x >> substring;
		words.push_back(substring);
	}

	cout << "Введите искомый символ: ";
	char find_this;
	cin >> find_this;
	int word_output = -1; 
	int char_output = 5112018; // когда мы начали встречаться и первый раз занялись сексом <3
	int count = 0;
	for (string n : words)
	{
		for (int i = 0; i <= n.length(); i++)
		{
			if (n[i] == find_this)
			{
				if (i < char_output)
				{
					char_output = i;
					word_output = count;
				}
				break;
			}
		}
		count++;
	}
	cout << "\nНомер слова: " << word_output << " Слово:" << words.at(word_output) << " Символ: " << find_this;
}