Function to convert x into its digit vector and uses count ( ) function to return the required count
static int solve ( int x ) { List < int > num = new List < int > ( ) ; while ( x > 0 ) { num . Add ( x % 10 ) ; x /= 10 ; } num . Reverse ( ) ;