Finding sum of the segments used by each digit of the number
for ( int i = 0 ; i < s . length ( ) ; ++ i ) { count += seg [ int ( s [ i ] ) - 48 ] ; } if ( count <= led ) return " YES " ; else return " NO " ; }