Wonderful Multisets by rolf

import java.io.BufferedReader;import java.io.InputStreamReader;class M{public static void main(String[] a) throws Exception{BufferedReader r=new BufferedReader(new InputStreamReader(System.in));while(true){String p=r.readLine();if(p==null)break;while (p.length()>1){p=p.replaceAll("\\{0+\\}", "0");p=p.replaceAll("\\{1*\\}", "1");p=p.replaceAll("01|10", "");}System.out.println(p);}}}

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

To protect the system from spam, please input your favorite sport (hint: I believe its name must start with 'g', case insensitive)


return to the top page