Find the number of players who roll the dice when the dice output sequence is given | C # implementation of the approach ; Function to return the number of players ; Initialize cnt as 0 ; Iterate in the string ; Check for numbers other than x ; Driver code
using System ; class GFG { static int findM ( String s , int x ) { int cnt = 0 ; for ( int i = 0 ; i < s . Length ; i ++ ) { if ( s [ i ] - '0' != x ) cnt ++ ; } return cnt ; } public static void Main ( ) { String s = "3662123" ; int x = 6 ; Console . Write ( findM ( s , x ) ) ; } }