Function to find the longest subsequence which contain all consonants
static String longestConsonantsSubsequence ( String str ) { String answer = " " ; int n = str . length ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( isConsonants ( str . charAt ( i ) ) ) { answer += str . charAt ( i ) ; } } return answer ; }