I wrote a code to find the substring from of a string from after "I have a " which is specifically nine characters. It gives the correct output on the first input but misses the first character on the second. Can anyone please tell me why ??
#include<bits/stdc++.h>
using namespace std;
int main()
    {
    int t;
    cin>>t;
    while(t--)
    {
        cin.ignore();
        string s1;
        getline(cin,s1);
        
        string s2;
        getline(cin,s2);
        
        int n1=s1.length();
        int n2=s2.length();
        
        string itema,itemb;
        itema=s1.substr(9,n1);
        cout<<itema<<endl;
        itemb=s2.substr(9,n2);
        cout<<itemb<<endl;
        cout<<"Uh! "<<itemb<<"-"<<itema<<"!"<<endl;
    }
    return 0;
    }
