Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <sstream>
- #include <string>
- #include <string.h>
- #include <algorithm>
- #include <vector>
- using namespace std;
- int main()
- {
- string inPut;
- getline(cin,inPut);
- istringstream ss(inPut);
- string word;
- vector<string> vec;
- vector<int> word_size;
- while(ss >> word)
- {
- string remove_number = "";
- for (char c : word)
- {
- if (!std::isdigit(c))
- {
- remove_number += c;
- }
- }
- if(remove_number.size() > 0)
- {
- vec.push_back(remove_number);
- }
- }
- int max_length = 0;
- for(auto i : vec)
- {
- if(max_length < i.length())
- {
- max_length = i.length();
- }
- }
- vector<string> max_word;
- for(int i =0; i < vec.size(); i++)
- {
- string max_string;
- max_string = vec[i];
- if(max_length == max_string.size())
- {
- max_word.push_back(max_string);
- }
- }
- sort(max_word.begin(),max_word.end());
- if(vec.size() == 0)
- {
- cout<<"no noise";
- }
- else
- {
- cout<<max_word[0];
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement