int n;
cin>>n;
cin.get();
Why after inputting the number of strings, have we used the function can.get()?
suppose your input is
asdf
jkl;
qwerty
now if you observe
after each string there is ‘\n’(due to enter pressed to go to next line)
when you write
getline(cin,str);
then it takes only asdf and ignore ‘\n’
to remove this ‘\n’ from input buffer we have to use cin.get()