Question: For example: insert 1 5 88 99 7 in a set if 1,5,88,99,7 is given as an input and then pressed Enter.
My code: 

```
#include <bits/stdc++.h>
using namespace std;
set <char> num;
set <char> ::iterator i;
int main()
{
 int a;
 while(a=getchar())
 {

    if(a!='\n')
    {
        if(a!=',')
            num.insert(a);
    }
    else
        break;
}
for(i=num.begin(); i!=num.end(); i++)
    cout<<*i<<endl;
}

```

The output I'm getting:
1
5
7
8
9

Answer: 
I think you are following this **[tutorial](https://www.youtube.com/playlist?list=PLn2n4GESV0AmXOWOam729bC47v0d0Ohee)**, which is actually made by me.

The problem in your code is in the following line:

```
DocumentReference selectedDoc = docRef.collection("products").document(shoppingListId);

```

You cannot delete a product using only that line of code. Your code is not complete. To solve this, change that line with:

```
DocumentReference productIdRef = rootRef.collection("products").document(shoppingListId)
            .collection("shoppingListProducts").document(productId);
productIdRef.delete().addOnSuccessListener(aVoid -> Snackbar.make(shoppingListViewFragment, "Product deleted!", Snackbar.LENGTH_LONG).show());

```

If you want to delete a ShoppingList, first you need to delete everything that is beneath it. So in order to delete a particular shopping list, first you need to find all the documents beneath the `shoppingListProducts` collection, delete them and right after that you'll be able to delete the `shoppingListId` document.
```
DocumentReference documentReference = firestore.collection("products").document(productid);
                                            documentReference.delete().addOnCompleteListener(new OnCompleteListener<Void>() {
                                                @Override
                                                public void onComplete(@NonNull Task<Void> task) {
                                                    if (task.isSuccessful()) {
                                                        Toast.makeText(Payment_Successful.this, "ok", Toast.LENGTH_SHORT).show();
                                                    } else {
                                                        Toast.makeText(Payment_Successful.this, "Not", Toast.LENGTH_SHORT).show();
                                                    }
                                                }

```