Language: C++

#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>

using namespace std;

int read()
{
    char c=getchar();
    int d=0;
    while(c<'0' || c>'9')c=getchar();
    while(c>='0' && c<='9'){d=(d<<3)+(d<<1)+(c^48);c=getchar();}
    return d;
}

#define MAXN 50

int n;
string s[MAXN+1];
int a[MAXN+1][27];

int main()
{
    n=read();
    for(int i=1;i<=n;i++)
    {
        getline(cin,s);
        for(int j=0;j<s.size();j++)a[i][s[j]-'a'+1]++;
    }
    for(int i=1;i<=26;i++)
    {
        int minn=233;
        for(int j=1;j<=n;j++)
        {
            minn=min(minn,a[j][i]);
            if(!minn)break;
        }
        for(int j=1;j<=minn;j++)putchar(i-1+'a');
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:16: error: no matching function for call to 'getline(std::istream&, std::string [51])'
   28 |         getline(cin,s);
      |         ~~~~~~~^~~~~~~
In file included from /usr/include/c++/14/string:55,
                 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.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
In file included from /usr/include/c++/14/string:54:
/usr/include/c++/14/bits/basic_string.h:4117: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>&)'
 4117 |     getline(basic_istream<_CharT, _Traits>& __is,
      |     ^~~~~~~
/usr/include/c++/14/bits/basic_string.h:4117:5: note:   template argument deduction/substitution failed:
a.cc:28:16: note:   mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'std::string [51]' {aka 'std::__cxx11::basic_string<char> [51]'}
   28 |         getline(cin,s);
      |         ~~~~~~~^~~~~~~
/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
/usr/include/c++/14/bits/basic_string.h:4132: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>&)'
 4132 |     getline(basic_istream<_CharT, _Traits>&& __is,
      |     ^~~~~~~
/usr/include/c++/14/bits/basic_string.h:4132:5: note:   template argument deduction/substitution failed:
a.cc:28:16: note:   mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'std::string [51]' {aka 'std::__cxx11::basic_string<char> [51]'}
   28 |         getline(cin,s);
      |         ~~~~~~~^~~~~~~
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
a.cc:29:25: error: request for member 'size' in 's', which is of non-class type 'std::string [51]' {aka 'std::__cxx11::basic_string<char> [51]'}
   29 |         for(int j=0;j<s.size();j++)a[i][s[j]-'a'+1]++;
      |                         ^~~~
a.cc:29:45: error: no match for 'operator-' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'char')
   29 |         for(int j=0;j<s.size();j++)a[i][s[j]-'a'+1]++;
      |                                         ~~~~^~~~
      |                                            | |
      |                                            | char
      |                                            std::string {aka std::__cxx11::basic_string<char>}
In file included from /usr/include/c++/14/string:48:
/usr/include/c++/14/bits/stl_iterator.h:618:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__y.base() - __x.base())) std::operator-(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
  618 |     operator-(const reverse_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:618:5: note:   template argument deduction/substitution failed:
a.cc:29:46: note:   'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
   29 |         for(int j=0;j<s.size();j++)a[i][s[j]-'a'+1]++;
      |                                              ^~~
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__x.base() - __y.base())) std::operator-(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
 1790 |     operator-(const move_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note:   template argument deduction/substitution failed:
a.cc:29:46: note:   'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
   29 |         for(int j=0;j<s.size();j++)a[i][s[j]-'a'+1]++;
      |                                              ^~~