How to implement an array of strings with different sizes, i.e. an array stringar[4]={"black","red","blue","green"}.
Also, how to access individual letters/characters of each element in C++?
Edit:
This is what I tried in CPP. But it gives the same output (i.e. 0) for all inputs.
code:
#include <bits/stdc++.h>
using namespace std;
int main()
{ int n,i,j,p,q,f=0,count=0,key,m;
char s[100][100];
cin>>n;
for( i = 0; i < n; i++)
for (j = 0; j < 100; j++)
cin >> s[i][j];
for(i=0;i<n;i++)
{
for (j = 0; j < 100; j++)
{
key = s[i][j];
for (p = i + 1; p < n; p++)
{
for (q = 0; q < m; q++)
{
if (key == s[p][q]) {f = 1;break;}
else {f = 0;continue;}
}
}
if (f == 1)
count++;
}
}
cout<<count;
return 0;
}

std::vector<std::string>count as "implementing" it for you?