fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. Ideone ob = new Ideone();
  13. int cid=2;
  14. String c1[]={"def is_even_sum(a, b):",
  15. " return (a + b) % 2 == 0"};
  16. String c2[]={"def is_even_sum(summand_1, summand_2):",
  17. " return (summand_1 + summand_2) % 2 == 0"};
  18. System.out.println(ob.plagiarismCheck(c1,c2));
  19.  
  20. }
  21.  
  22. boolean isEqual(String[] code1, String[] code2)
  23. {
  24. int i;
  25. for(i=0;i<code1.length;i++)
  26. {
  27. if(code1[i].equals(code2[i])==false)
  28. break;
  29. }
  30. if(i==code1.length)
  31. return true;
  32. return false;
  33. }
  34.  
  35.  
  36. boolean plagiarismCheck(String[] code1, String[] code2) {
  37. if(isEqual(code1, code2))
  38. return true;
  39. int i;
  40. String c3[]=new String[code1.length];
  41. String c4[]=new String[code1.length];
  42. for(i=0;i<code1.length;i++)
  43. {
  44. c3[i]=code1[i];
  45. c4[i]=code2[i];
  46. }
  47. String tmp[]=c3[0].split(",");
  48. String var1=tmp[0].substring(tmp[0].indexOf('(')+1);
  49. String var2=tmp[1].trim().substring(0, tmp[1].trim().indexOf(')'));
  50. tmp=c4[0].split(",");
  51. String var3=tmp[0].substring(tmp[0].indexOf('(')+1);
  52. String var4=tmp[1].trim().substring(0, tmp[1].trim().indexOf(')'));
  53. System.out.println(var1+" "+var2);
  54. System.out.println(var3+" "+var4);
  55. String v3="cc",v4="dd";
  56. for(i=0;i<code1.length;i++)
  57. {
  58. c3[i]=c3[i].replace(var1,var3);
  59. c3[i]=c3[i].replace(var2,var4);
  60. }
  61. for(i=0;i<c3.length;i++)
  62. System.out.println(c3[i]);
  63. if(isEqual(c3,c4))
  64. return true;
  65. return false;
  66. }
  67.  
  68.  
  69.  
  70. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:3:1: error: ‘import’ does not name a type; did you mean ‘short’?
 import java.util.*;
 ^~~~~~
 short
prog.cpp:4:1: error: ‘import’ does not name a type; did you mean ‘short’?
 import java.lang.*;
 ^~~~~~
 short
prog.cpp:5:1: error: ‘import’ does not name a type; did you mean ‘short’?
 import java.io.*;
 ^~~~~~
 short
prog.cpp:10:8: error: expected ‘:’ before ‘static’
  public static void main (String[] args) throws java.lang.Exception
        ^~~~~~~
        :
prog.cpp:10:27: error: ‘String’ has not been declared
  public static void main (String[] args) throws java.lang.Exception
                           ^~~~~~
prog.cpp:10:36: error: expected ‘,’ or ‘...’ before ‘args’
  public static void main (String[] args) throws java.lang.Exception
                                    ^~~~
prog.cpp:10:40: error: expected ‘;’ at end of member declaration
  public static void main (String[] args) throws java.lang.Exception
                                        ^
                                         ;
prog.cpp:10:42: error: ‘throws’ does not name a type
  public static void main (String[] args) throws java.lang.Exception
                                          ^~~~~~
prog.cpp:22:1: error: ‘boolean’ does not name a type; did you mean ‘bool’?
 boolean isEqual(String[] code1, String[] code2)
 ^~~~~~~
 bool
prog.cpp:36:1: error: ‘boolean’ does not name a type; did you mean ‘bool’?
 boolean plagiarismCheck(String[] code1, String[] code2) {
 ^~~~~~~
 bool
prog.cpp:70:2: error: expected ‘;’ after class definition
 }
  ^
  ;
stdout
Standard output is empty