While solving a UVa question, I got this String and I need to split it an array of String removing # and @
Brazil#2@1#Scotland
I was getting a ArrayOutOfBounds exception when I used,
matchSummary.split("#@");
after researching solutions for this UVa question, I found that other experienced competitive programmers have done it like this,
string.split("[#@]");
and this passes the verdict of online judge.
I cant get this String split for this aforementioned String
My complete solution for this question is available here- see
Can anybody explain to me why my code worked with split("[#@]");?
#and@" — How should the final array look like?"#@"and"[#@]".