For this Question: Bob has a string S consisting of lowercase English letters. He defines S′ to be the string after removing all "a" characters from S (keeping all other characters in the same order). He then generates a new string T by concatenating S and S′. In other words, T=S+S′.

You are given a string T. Your task is to find some S that Bob could have used to generate T. It can be shown that if an answer exists, it will be unique.The first line contains a single string S.

Constraints:
1<=|S|<=100000Print a string S that could have generated T. It can be shown if an answer exists, it is unique. If no string exists, print ":(" (without double quotes, there is no space between the characters).Sample Input 1:
ababacacbbcc

Sample Output 1:
ababacac

Explanations:
we have s= "ababacac", and s′= "bbcc", and t=s+s′= "ababacacbbcc"., I have written this Solution Code: import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String S = in.next();
        StringBuilder sb = new StringBuilder();
        for (char c : S.toCharArray()) {
            if (c != 'a') {
                sb.append(c);
            }
        }
        boolean ok = true;
        if (sb.length() % 2 == 0) {
            int length = sb.length()/2;
            for (int i=0; i<length; i++) {
                if (sb.charAt(i) != sb.charAt(i+length)) {
                    ok = false;
                    break;
                }
            }
            if (S.lastIndexOf('a') >= S.length() - length) {
                ok = false;
            }
            if (ok) {
                System.out.println(S.subSequence(0, S.length() - length));
            }
        } else {
            ok = false;
        }
        if (!ok) {
            System.out.println(":(");
        }
    }

}
, In this Programming Language: Java, Now tell me if this Code is compilable or not?