#include <iostream>
#include<cstdio>
#include<cstring>
#include<utility>
#include<map>
using namespace std;
map<string,int>mp;
void password(int len,string ss)
{
int l=ss.length();
mp.clear();
for(int i=0; i<(l-len)+1; i++)
{
string str=ss.substr(i,len);
mp[str]++;
}
int large=0;
for(map<string,int>::iterator it=mp.begin(); it!=mp.end(); it++)
{
if(it->second>large)
{
large=it->second;
}
}
if(large==1)
{
cout<<ss<<endl;
}
else
{
for(map<string,int>::iterator it=mp.begin(); it!=mp.end(); it++)
{
if(it->second==large)
{
cout<<it->first<<endl;
break;
}
}
}
}
int main()
{
int len;
string ss;
while(cin>>len>>ss)
{
password(len, ss);
}
return 0;
}
#include<cstdio>
#include<cstring>
#include<utility>
#include<map>
using namespace std;
map<string,int>mp;
void password(int len,string ss)
{
int l=ss.length();
mp.clear();
for(int i=0; i<(l-len)+1; i++)
{
string str=ss.substr(i,len);
mp[str]++;
}
int large=0;
for(map<string,int>::iterator it=mp.begin(); it!=mp.end(); it++)
{
if(it->second>large)
{
large=it->second;
}
}
if(large==1)
{
cout<<ss<<endl;
}
else
{
for(map<string,int>::iterator it=mp.begin(); it!=mp.end(); it++)
{
if(it->second==large)
{
cout<<it->first<<endl;
break;
}
}
}
}
int main()
{
int len;
string ss;
while(cin>>len>>ss)
{
password(len, ss);
}
return 0;
}
কোন মন্তব্য নেই:
একটি মন্তব্য পোস্ট করুন