For this Question: You are given a 0- indexed binary string target of length n. You have another binary string s of length n that is initially set to all zeros. You want to make s equal to target.

In one operation, you can pick an index i where 0 <= i < n and flip all bits in the inclusive range [i, n - 1]. Flip means changing '0' to '1' and '1' to '0'.

Return the minimum number of operations needed to make s equal to target.There will be a string target will be given in the first line of Input.

<b>Constraints</b>
n == target. length
1 <= n <= 10^5
target[i] is either '0' or '1'.Return the minimum number of operations needed to make s equal to target.Sample Input:
10111
Sample Output:
3

Explanation: Initially, s = "00000".
Choose index i = 2: "00000" - > "00111"
Choose index i = 0: "00111" - > "11000"
Choose index i = 1: "11000" - > "10111"
We need at least 3 flip operations to form target., I have written this Solution Code: import java.util.*;

public class Main{

    public int minFlips(String target) {
        int ans=0;
        for(int i=0;i<target.length();i++){
            if(target.charAt(i)=='1'&&ans%2==0)ans++;
            else if(target.charAt(i)=='0'&&ans%2!=0)ans++;
        }
        return ans;
    }

    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        String s;
        s = sc.next();
   
        Main obj = new Main();
        int ans = obj.minFlips(s);
        System.out.println(ans);
        return;
    }
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?