Advertisement
Guest User

Problem 7 – The Noise and the Signal

a guest
Oct 7th, 2019
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. #include <iostream>
  2. #include <sstream>
  3. #include <string>
  4. #include <string.h>
  5. #include <algorithm>
  6. #include <vector>
  7.  
  8. using namespace std;
  9.  
  10. int main()
  11. {
  12. string inPut;
  13. getline(cin,inPut);
  14.  
  15. istringstream ss(inPut);
  16. string word;
  17. vector<string> vec;
  18.  
  19. while(ss >> word)
  20. {
  21. string remove_number = "";
  22. for (char c : word)
  23. {
  24. if (!std::isdigit(c))
  25. {
  26. remove_number += c;
  27.  
  28. }
  29.  
  30. }
  31. if(remove_number.size() > 0)
  32. {
  33. vec.push_back(remove_number);
  34. }
  35.  
  36. }
  37.  
  38.  
  39.  
  40. sort( vec.begin(), vec.end());
  41.  
  42.  
  43. if(vec.size() == 0)
  44. {
  45. cout<<"no noise";
  46. }
  47. else
  48. {
  49. //for(int i =0; i < vec.size(); i ++)
  50. cout<<vec[0];
  51. }
  52.  
  53. return 0;
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement