deepika deepi wrote:I take the input in a string
A string or an array of strings?
Loop over the array and print each of the elements between brackets. Please try to write some code yourself first, and if you get stuck, post it here and we can help you further.
If you want to know how to make a loop, see
The for Statement in Oracle's
Java Tutorials.