Răspuns:
#include <iostream>
#include <string.h>
using namespace std;
unsigned int vf[101];
int main()
{
char s[101], *p;
cin.get(s,101);
p=strtok(s," ");
while(p)
{
vf[strlen(p)]++;
p=strtok(NULL, " ");
}
for(unsigned int i=0; i<=100; i++)
if(vf[i]==1)
cout << vf[i] << " cuvant de lungime "<< i << endl;
else
if(vf[i]>1)
cout<< vf[i] << " cuvinte de lungime "<< i<< endl;
return 0;
}
Explicație: