text: Driver code
code: public static void main ( String args [ ] ) { String str = " GeeksforGeeks ▁ A ▁ computer ▁ science ▁ portal ▁ for ▁ geeks ▁ " ; String word = " portal " ; System . out . println ( countOccurrences ( str , word ) ) ; } }