Position of the last zero
Xem dạng PDF        
            Gửi bài giải
        
    
        
        
    
    
    
    
    
        
        
                
        
            
        
        Điểm:
        
                1,00 (OI)        
    
    
        Giới hạn thời gian:
        1.0s
    
    
        Giới hạn bộ nhớ:
        256M
    
    
            Input:
            stdin
        
        
            Output:
            stdout
        
    
            Nguồn bài:
            
        
        
                    Dạng bài                
                
        
                Ngôn ngữ cho phép
            
            
C, C++, Java, Kotlin, Pascal, PyPy, Python, Scratch            
        Given a string ~S~ consisting only of the digits ~0~ and ~1~. It is known that all ~0~ precede all ~1~ in the string ~S~. Determine the position of the last ~0~ in the sequence.
Input:
- A string ~S~ (length of ~S \leq 5×10^6~ ) containing only the digits ~0~ and ~1~. The string always contains at least one ~0~ and one ~1~.
Output:
- An integer representing the position of the last ~0~ in the sequence.
Sample Input
000111
Sample Output
3
Bình luận