Language: C++

#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    for(;;){
        string s;
        for(;;){
            string tmp;
            getline(cin, tmp);
            if(tmp == "")
                break;
            s += tmp;
        }
        int n = s.size();

        string key;
        getline(cin, key);
        int m = key.size();
        vector<bool> isKey(256, false);
        for(int i=0; i<m; ++i)
            isKey[key[i]] = true;

        vector<int> last(256, -1);
        multiset<int> ms;
        int num;
        int head;
        int len = INT_MAX;
        for(int i=0; i<n; ++i){
            if(isKey[s[i]]){
                if(last[s[i]] != -1)
                    ms.erase(ms.find(last[s[i]]));
                last[s[i]] = i;
                ms.insert(i);

                if(ms.size() == m){
                    int len2 = i - *(ms.begin()) + 1;
                    if(len2 < len){
                        len = len2;
                        num = 1;
                        head = *(ms.begin());
                    }else if(len2 == len){
                        ++ num;
                    }
                }
            }
        }

        if(len == INT_MAX){
            cout << '0';
        }else{
            cout << num << endl << endl;
            while(len > 72){
                cout << s.substr(head, 72) << endl;
                head += 72;
                len -= 72;
            }
            cout << s.substr(head, len) << endl;
        }

        if(!getline(cin, string()))
            return 0;
        cout << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:76:20: error: no matching function for call to 'getline(std::istream&, std::string)'
   76 |         if(!getline(cin, string()))
      |             ~~~~~~~^~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:4132:5: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::getline(basic_istream<_CharT, _Traits>&&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&) [with _CharT = char; _Traits = char_traits<char>; _Alloc = allocator<char>]' (near match)
 4132 |     getline(basic_istream<_CharT, _Traits>&& __is,
      |     ^~~~~~~
/usr/include/c++/14/bits/basic_string.h:4132:5: note:   conversion of argument 2 would be ill-formed:
a.cc:76:26: error: cannot bind non-const lvalue reference of type 'std::__cxx11::basic_string<char>&' to an rvalue of type 'std::string' {aka 'std::__cxx11::basic_string<char>'}
   76 |         if(!getline(cin, string()))
      |                          ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:4117:5: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::getline(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&) [with _CharT = char; _Traits = char_traits<char>; _Alloc = allocator<char>]' (near match)
 4117 |     getline(basic_istream<_CharT, _Traits>& __is,
      |     ^~~~~~~
/usr/include/c++/14/bits/basic_string.h:4117:5: note:   conversion of argument 2 would be ill-formed:
a.cc:76:26: error: cannot bind non-const lvalue reference of type 'std::__cxx11::basic_string<char>&' to an rvalue of type 'std::string' {aka 'std::__cxx11::basic_string<char>'}
   76 |         if(!getline(cin, string()))
      |                          ^~~~~~~~
In file included from /usr/include/c++/14/string:55:
/usr/include/c++/14/bits/basic_string.tcc:907:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::getline(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&, _CharT)'
  907 |     getline(basic_istream<_CharT, _Traits>& __in,
      |     ^~~~~~~
/usr/include/c++/14/bits/basic_string.tcc:907:5: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/basic_string.h:4125:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::getline(basic_istream<_CharT, _Traits>&&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&, _CharT)'
 4125 |     getline(basic_istream<_CharT, _Traits>&& __is,
      |     ^~~~~~~
/usr/include/c++/14/bits/basic_string.h:4125:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/cstdio:42,
                 from /usr/include/c++/14/ext/string_conversions.h:45,
                 from /usr/include/c++/14/bits/basic_string.h:4154:
/usr/include/stdio.h:697:18: note: candidate: '__ssize_t getline(char**, size_t*, FILE*)'
  697 | extern __ssize_t getline (char **__restrict __lineptr,
      |                  ^~~~~~~
/usr/include/stdio.h:697:18: note:   candidate expects 3 arguments, 2 provided