Subanagrams Compilation Error

I am trying this problem https://www.codechef.com/problems/SUBANAGR and it is showing correct output in my editor but in codechef it is showing compilation error with page opening no description about error.
c=Can you help me with that.Below is my code in C++.

#include<iostream>
#include<string>
using namespace std;
int f(char a)
{
	return (((int)a)-97);
}
char f(int a)
{
	return ((char)(a+97));
}
int main()
{
	int n;
	cin>>n;int a[100][26];
	for(int i=0;i<100;i++)
			for(int j=0;j<26;j++)
				a[i][j]=0;
	for(int i=0;i<n;i++)
	{
		string s;cin>>s;
		for(int j=0;j<s.length();j++)
				a[i][f(s[j])]++;
	}
	string s="";
	for(int i=0;i<26;i++)
		{
			int m=INT_MAX;
			for(int j=0;j<n;j++)
				m=min(a[j][i],m);
			if(m!=0)
				while(m--)
					s=s+f(i);
		}
	if(s=="")
	cout<<"no such string";
	else
	cout<<s;
	cout<<"\n";
}

I receive the following error:

a.cpp: In function ‘int main()’:
a.cpp:28:19: error: ‘INT_MAX’ was not declared in this scope
             int m=INT_MAX;
                   ^

INT_MAX is defined in the header <climits> (http://www.cplusplus.com/reference/climits/), so include that.

1 Like