@officialharshit1996 if you want to do in that way then you have to declare the array of strings as dynamically and then you have to do every thing on array .
and if you are doing like this then you are unnecessarily making your program complicated and when it only depends everything on your logic .
if you still have any doubt you can ask here .
but if you feel that your doubt is cleared you can now mark this doubt as resolved .
Happy Learning !!