Kiri3L

Untitled

Dec 22nd, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.66 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <limits>
  4.  
  5. using namespace std;
  6.  
  7. int main() {
  8.     ifstream in("../input.txt");
  9.     string s;
  10.     int count = 0;
  11.     int min = numeric_limits<int>::max();
  12.     char c;
  13.     string min_s = "";
  14.     string current_s = "";
  15.     while (in >> s){
  16.         current_s += ' ' + s;
  17.         c = s[s.size() - 1];
  18.         count++;
  19.         if(c == '.' || c == '!' || c == '?') {
  20.             if (min > count) {
  21.                 min = count;
  22.                 min_s = current_s;
  23.             }
  24.             count = 0;
  25.             current_s = "";
  26.         }
  27.     }
  28.     cout << min << endl;
  29.     cout << min_s << endl;
  30.     return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment