fork download
  1. public class MakeTwoConsecutive {
  2.  
  3. boolean ok(String S) {
  4. for(int i = 0; i < S.length() - 1; ++i)
  5. if(S.charAt(i) == S.charAt(i+1))
  6. return true;
  7. return false;
  8. }
  9.  
  10. public String solve(String S) {
  11. for(int i = 0; i < S.length(); ++i)
  12. if(ok(S.substring(0, i) + S.substring(i+1)))
  13. return "Possible";
  14. return "Impossible";
  15. }
  16. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:1: error: class MakeTwoConsecutive is public, should be declared in a file named MakeTwoConsecutive.java
public class MakeTwoConsecutive {
       ^
1 error
stdout
Standard output is empty