I am a beginner in programming and currently learning Ruby. Can't figure this out. Could someone solve? : You are given a string S Count the number of occurrences of all the digits in the string S.

Input:
First line contains string S

Output:
Count the number of occurences of 1 in the entered number and print the output.
 I tried to attempt the given problem like this:

    number=$stdin.gets.chomp
    number.split('').map(&:to_i)
     number.each do |numbers|
       i==0
     while numbers===1
         i+=1
        end
    
     end
    
    
     puts i

But, its not executing.
Can someone please suggest how to do it?