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
lineN #Each line will contain characters <=1000 and may be a single sentence, a text snippet or a small paragraph
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

2 Years
Discussion Span
Last Post by samasif

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()
    int n,sz=0;
    string s[1001];
    char c;
    getchar();string s1="";
    for(int i=0;i<n;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];
    int i=0,l=0,j=0,k=0;bool ch=false,ans=true;
       if(c==' ' or c=='\n' or c=='\r')continue;
       if(c==s1[i] )
            else i++;

        cout<<"It is present in amazon_river file ..Hurray"<<endl;
        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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.