#include<iostream>
using namespace std;
int main()
{
int t;
cin >> t;
string str;
for(int i=0;i<=t-1;i++)
{
cin >> str;
if(str.at(0)==‘1’)
cout << “10”<<str.substr(1,str.length()-1) << endl;
else
cout << "1"<<str<<endl;
}
return 0;
}
I wrote this code and custom input is showing expected results while when I try to compile without inputs then SIGABRT(runtime error) and
terminate called after throwing an instance of ‘std::out_of_range’
what(): basic_string::at: __n (which is 0) >= this->size() (which is 0) is thrown
Please help if anyone can help me find my mistake!