2075 / C++ / Додатково / Розбити рядок
Розбити по пробілах 1 int a = line.find(" "); line.substr(0, a) line.substr(a + 1, line.length() - a - 1); Розбити по пробілах 2 string word = ""; for (auto x : str) { if (x == ' ') { cout << word << endl; word = ""; } else { word = word + x; } } cout << word << endl; Розбити по комах і \n string word = ""; for (auto x : str) { if (x == ',' || x == '\n') { cout << word << endl; word = ""; } else { word = word + x; } } cout << word << endl;