Pagini recente » Cod sursa (job #2140900) | Cod sursa (job #1990967) | Cod sursa (job #2687766) | Cod sursa (job #2005513) | Cod sursa (job #105936)
Cod sursa(job #105936)
#include <stdio.h>
#include <string.h>
#include <string>
#include <map>
#include <hash_map>
using namespace std;
/*struct eqstr
{
bool operator()(const char* s1, const char* s2) const
{
return strcmp(s1, s2) == 0;
}
};
string temp;
*/
hash_map<const char*, int, hash<const char*>, eqstr> cuv;
int main()
{
freopen("abc2.in","r",stdin);
freopen("abc2.out","w",stdout);
gets(s);
while (scanf("%s",&a[++i])>0)
{
l = strlen(a[i]);
cuv[a[i]] = 1;
if (l>lmax) lmax = l;
}
n = i;
for (i = 0; a[i] != '\0'; ++ i)
{
for (j = 0; j < lmax && a[j+i] != '\0'; ++ j)
{
temp.clear();
temp.push_back(a[j+i]);
if (cuv[temp])
++sol;
}
}
printf("%d\n", sol);
}