C ++ program to find the number of charters in the longest word in the sentence .
#include <bits/stdc++.h> NEW_LINE using namespace std ; int LongestWordLength ( string str ) { int counter = 0 ; string words [ 100 ] ; for ( short i = 0 ; i < str . length ( ) ; i ++ ) { if ( str [ i ] == ' ▁ ' ) counter ++ ; else words [ counter ] += str [ i ] ; } int length = 0 ; for ( string word : words ) { if ( length < word . length ( ) ) { length = word . length ( ) ; } } return length ; }