CPP program to count number of substrings of a string
#include <bits/stdc++.h> NEW_LINE using namespace std ; int countNonEmptySubstr ( string str ) { int n = str . length ( ) ; return n * ( n + 1 ) / 2 ; }