Loop is executing for one less time than required
@d1sha_singh when using nextline after next it is reading the blank space after the integer.
u can add an extra s.nextline(); after u input the integer .
int t=sc.nextInt();
sc.nextLine();
for(int i=0;i<t;i++){
String s=sc.nextLine();
remPi(s+" ",1);
}
1 Like