Function that returns true if s contains three consecutive 1 's
static bool check ( String s ) { int n = s . Length ; for ( int i = 2 ; i < n ; i ++ ) { if ( s [ i ] == '1' && s [ i - 1 ] == '1' && s [ i - 2 ] == '1' ) return true ; } return false ; }