Hi to all! i need help for my program

i need to read and write csv file

this will be the input in my csv file
folder assigned letter depth
\a m 0
\b n 0
\b\c n 1
\b\c\d o 2
\b\c\d\e p 3
\b\c\d\e\f n 4
\b\g n 1
\c n 0

and this should be the output in csv file

\a m
\b n
\b\c\d o
\b\c\d\e p
\c n

anyone can help me?? please thanks alot.

What, exactly, are you having problems with?

What, exactly, are you having problems with?

the codes that will be use

Well, those we are not going to give you.

If you post your code and explain exactly what is going wrong with it (i.e. compile/error messages) we will help you with it, but we are not going to do it for you.