import java.util.Arrays;
public class YuGiOh
{
private static void makeLove ( int[] a )
{
String tmp = " " + Arrays.toString (a).replaceAll ("[\\[\\]]", ",").replaceAll ("\\s", "").replaceAll ("(?<=\\d+)\\,(?=\\d+)", ",,") + " ";
String result = " ";
for ( int i = 0; i < a.length; i++ )
{
int ai = a[i];
if (( tmp.split ("\\," + ai + "\\,").length - 1 ) % 2 != 0)
{
if (result.indexOf (" " + ai + " ") == -1)
{
result += ai + " ";
}
}
}
System.out.println (result.trim ());
}
public static void main ( String[] args )
{
int[] a = { 1, 1, 1, 2, 4, 3, 3 };
makeLove (a);
}
}
温馨提示:答案为网友推荐,仅供参考