String std::logic_error: basic_string::_S_construct null not valid
07:05 02 Nov 2021
#include 
#include 

using namespace std;

int main()
{
    string S = 0; 
    int T,R;
    
    cin >> S >> R;
    
    for(int i = 0; i < T; i++)
    {
        for(int k = 0; k < S.length(); k++)
        {
            for(int j = 0; j < R; j++)
            {
                cout << S[k];
            }
        }
        cout << endl;
    }
    
    return 0;
}

The error pool statement is:

terminate called after throwing an instance of 'std::logic_error'
   what(): basic_string::_S_construct null not valid
c++ stl stdstring