Function to check whether the string contains any consecutive repetitive characters and any characters other than those in str
public static bool check ( String s , String str ) { char [ ] chars = s . ToCharArray ( ) ;