Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <limits>
- using namespace std;
- int main() {
- ifstream in("../input.txt");
- string s;
- int count = 0;
- int min = numeric_limits<int>::max();
- char c;
- string min_s = "";
- string current_s = "";
- while (in >> s){
- current_s += ' ' + s;
- c = s[s.size() - 1];
- count++;
- if(c == '.' || c == '!' || c == '?') {
- if (min > count) {
- min = count;
- min_s = current_s;
- }
- count = 0;
- current_s = "";
- }
- }
- cout << min << endl;
- cout << min_s << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment