UVa: 12250 (Language Detection)


// https://uva.onlinejudge.org/external/122/p12250.pdf

// @BEGIN_OF_SOURCE_CODE

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <cctype>
#include <stack>
#include <queue>
#include <list>
#include <vector>
#include <map>
#include <sstream>
#include <cmath>
#include <bitset>
#include <utility>
#include <set>
#include <ctime>

#define Inf 2147483647
#define Pi acos(-1.0)
#define N 10000 + 10
#define LL long long
#define F(i, n) for( int i = (0); i < (n); i++ )
#define Fs(i, sz) for( size_t i = 0; i < sz.size (); i++ )
#define Set(a, s) memset(a, s, sizeof (a))
inline LL Power(int b, int p) { LL r = 1; for ( int i = 1; i <= p; i++ ) r *= b; return r; }

using namespace std;


int main ()
{
    string helloArray [] = {"HELLO",
            "HOLA",
            "HALLO",
            "BONJOUR",
            "CIAO",
            "ZDRAVSTVUJTE"};

    string languageArray [] = {"ENGLISH",
            "SPANISH",
            "GERMAN",
            "FRENCH",
            "ITALIAN",
            "RUSSIAN"};


    string input;
    int cases = 0;

    while (cin >> input && input != "#") {

        int len = 6;
        bool found = false;

        for ( int i = 0; i < len; i++ ) {
            if (helloArray [i] == input) {
                printf ("Case %d: %s\n", ++cases, languageArray [i].c_str());
                found = true;
                break;
            }
        }

        if (!found) {
            printf ("Case %d: UNKNOWN\n", ++cases);
        }

    }

    return 0;
}

// @END_OF_SOURCE_CODE

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s