write a java method to decode a given
string as follows
the given string will be written in the
form n1[c]n2[c]
(Where n is an integer between 1 and 100, c is
any character)
Ex:
input: 3[a]4[r]2[c]
output: aaarrrrcc
The header of the method should
be
public static String decode(String
s)
Hint: to split a string using ([) or
(]) character you should write it as follows
String s1[]=s.split("\\[")
write a java method to decode a given string as follows the given string will be written in the form n1[c]n2[c]
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
write a java method to decode a given string as follows the given string will be written in the form n1[c]n2[c]
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!