Amazon is famous e-commerce company and one of the biggest Internet based retailer.
Amazon is also a great river in South America, largest river by discharge of water in the world.

You are provided two text files completely taken from Wikipedia, one file is the description of Amazon the company and one file is the description of Amazon the river. The name of the files are amazon_company.txt and amazon_river.txt The files can be found here or here

You will be provided with a file (again a simple text file) as input which will contain multiple lines. Each line will either be a sentence or a text snippet or a small paragraph which will be either related to Amazon the company or Amazon the river. Your task is to write code to identify which one is referred to. The format of input file will be as follows:

An integer N where N<=100
line1
line2
line3
..
..
lineN #Each line will contain characters <=1000 and may be a single sentence, a text snippet or a small paragraph
SAMPLE INPUT:
Boat Saves Lives On The Tropical Currents Of The Amazon: In this remote location, the Amazon River is the highway for transportation and is the only means of acquiring goods. For this reason, obtaining
EBay's once-loyal merchants are moving more of their business to Amazon, saying they get more for their money by selling merchandise via the web retailer.
Millward Brown Digital’s study shows the percentage of Amazon's traffic from Amazon Prime members increased 300% in the last year. This increase means a growing number of shoppers visiting other retailers’ websites are also Prime members.
The world's mightiest waterway, the Amazon, is threatened by the most diminutive of foes — a tiny mussel invading from China.
The Amazon, according to many accounts, was named by Spanish explorer Fransisco de Orellana in 1541. The name was in honor of the female warriors he encountered on his voyage through the territory previously called Maranon.

Your output would be a single text file which will simply tell whether the entry is related to the Amazon company or the Amazon river. For example the above input will give the following output

Amazon River
Amazon Company
Amazon Company
Amazon River
Amazon River

Please read the terms of service/use for these forums. We do not do your homework for you. When you have written the code to solve the assignment, and you are having errors or problems, then post it here and we may be able to help.

Sir,I am not very good in programming.
i need a help to know how to solve this problem what approach should i will apply.
please if you help me out i am very thankful you.

#include <bits/stdc++.h>
using namespace std;

typedef long long int ll;

typedef vector<int>vi;
typedef pair<int,int>ii;
typedef vector<ii>vii;
#define M 1000000007
const int INF = (int) 1e9;
const int MAX = (int) 1e5 + 10;

int main()
{
    //freopen("input.txt","r",stdin);
    int n,sz=0;
    string s[1001];
    char c;
    cin>>n;
    getchar();string s1="";
    for(int i=0;i<n;i++)
    {
        getline(cin,s[i]);
        string s2="";
        for(int j=0;j<s[i].size();j++)
        if(s[i][j]!=' ' and s[i][j]!='\n' )s2+=s[i][j];
        sz+=s2.size();
        s1+=s2;
    }
    freopen("amazon_river.txt","r",stdin);
    int i=0,l=0,j=0,k=0;bool ch=false,ans=true;
    while(scanf("%c",&c)!=EOF)
    {
       if(k==sz)
       {
        ans=false,l=k;break;
       }
       if(c==' ' or c=='\n' or c=='\r')continue;
       if(c==s1[i] )
        {
            k++;
            if(c=='\n')i++,j=0;
            else i++;
        }
        else
        {
            //if(k>0)cout<<(int)c<<":P"<<endl;
            i=0,j=0;k=0;
        }
    }

    if(!ans)
    {
        cout<<"It is present in amazon_river file ..Hurray"<<endl;
    }
    else
    {
        cout<<"It is present in amazon_company file .. Hurray"<<endl;
    }
    return 0;
}

i tried it in c++ but it is not giving a desired result.
any language can be acceptable.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.