Given a binary string s, return true if the longest contiguous segment of 1's is strictly longer than the longest contiguous segment of 0's in s, or return false otherwise.


	For example, in s = "110100010" the longest continuous segment of 1s has length 2, and the longest continuous segment of 0s has length 3.


Note that if there are no 0's, then the longest continuous segment of 0's is considered to have a length 0. The same applies if there is no 1's.

&nbsp;
Example 1:

Input: s = "1101"
Output: true
Explanation:
The longest contiguous segment of 1s has length 2: "1101"
The longest contiguous segment of 0s has length 1: "1101"
The segment of 1s is longer, so return true.


Example 2:

Input: s = "111000"
Output: false
Explanation:
The longest contiguous segment of 1s has length 3: "111000"
The longest contiguous segment of 0s has length 3: "111000"
The segment of 1s is not longer, so return false.


Example 3:

Input: s = "110100010"
Output: false
Explanation:
The longest contiguous segment of 1s has length 2: "110100010"
The longest contiguous segment of 0s has length 3: "110100010"
The segment of 1s is not longer, so return false.


&nbsp;
Constraints:


	1 &lt;= s.length &lt;= 100
	s[i] is either '0' or '1'.


class Solution:
    def checkZeroOnes(self, s: str) -> bool:
        s1 = s.split('0')
        s0 = s.split('1')
        r1 = max([len(i) for i in s1])
        r0 = max([len(i) for i in s0])
        return r1>r0
class Solution {
    public boolean checkZeroOnes(String s) {
        int length1 = 0;
        int length0 = 0;

        int i = 0;
        while(i < s.length()){
            int temp = 0;
            while(i < s.length() && s.charAt(i) == '1'){ //counting 1s
                temp++;
                i++;
            }
            length1 = Math.max(temp,length1);
            temp = 0;
            while(i < s.length() && s.charAt(i) == '0'){ // counting 0s
                temp++;
                i++;
            }
            length0 = Math.max(temp,length0);
        }
       return length1 > length0;
    }
}
class Solution {
public:
    bool checkZeroOnes(string s) {
        int count1=0;
        int count2=0;
       int max1=0;int max2=0;
        for(int i=0;i<s.size();i++)
        {
            if(s[i]=='1')
            {
                count1++;
                if(s[i+1]!=s[i])
                {
                    max1=max(count1,max1);
                    count1=0;
                }
            }
            
            if(s[i]=='0')
            {
                count2++;
                if(s[i+1]!=s[i])
                {
                    max2=max(count2,max2);
                    count2=0;
                }
            }
        }
        
        if(max1>max2)
            return true;
        return false;
        
        
    }
};
var checkZeroOnes = function(s) {
    let longest1 = 0;
    let longest0 = 0;

    let count1 = 0;
    let count0 = 0;

    for (let i = 0; i < s.length; i++) {
        const bit = s.charAt(i);

        if (bit === "1") count1++;
        else count1 = 0;

        if (bit === "0") count0++;
        else count0 = 0;

        longest1 = Math.max(longest1, count1);
        longest0 = Math.max(longest0, count0);
    }

    return longest1 > longest0;
};
Longer Contiguous Segments of Ones than Zeros