Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <vector>
- #include <sstream>
- #include <algorithm>
- using namespace std;
- int main() {
- string str;
- getline(cin, str);
- istringstream ss(str);
- vector<string> noises;
- while (ss >> str) {
- string noise;
- for (char c : str) {
- if (!isdigit(c)) {
- noise += c;
- }
- }
- if (noises.size() > 0) {
- if (noises.front().length() > noise.length()) {
- continue;
- }
- else if (noises.front().length() < noise.length()) {
- noises = {};
- }
- }
- noises.push_back(noise);
- }
- sort(noises.begin(), noises.end());
- cout << (noises.front() != "" ? noises.front() : "no noise") << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement