Witam, otóż mam problem, zadanie daje dobre odpowiedzi, po sprawdzeniu na ideone, także jest wszystko okej ale na SPOJu nie przyjmuje mi zadania i mówi, że błędna odpowiedź, nie wiem zbytnio co mam tu źle.
Oto mój kod skopiowany z ideone
import java.util.Scanner;
import java.util.regex.*;
import java.util.LinkedList;
class Ideone
{
public static Scanner userInput = new Scanner(System.in);
public static void main (String[] args) throws java.lang.Exception
{
while( userInput.hasNextLine() )
{
String str2Check = userInput.nextLine();
LinkedList<String> myList = regexChecker( "</?[A-Za-z]+>" ,str2Check);
int mL = myList.size();
String newString = "";
for(int i=0; i<mL; i++)
{
newString = str2Check.replace(myList.get(i), myList.get(i).toUpperCase() );
str2Check = newString;
}
System.out.println(newString);
}
}
public static LinkedList<String> regexChecker(String theRegex,String str2Check)
{
LinkedList<String> myList = new LinkedList<String>();
Pattern checkRegex = Pattern.compile(theRegex);
Matcher regexMatcher = checkRegex.matcher(str2Check);
while(regexMatcher.find())
{
if(regexMatcher.group().length() != 0)
{
myList.add( regexMatcher.group().trim() );
}
}
return myList;
}
}