12250 - Language Detection

来源:互联网 发布:屏蔽软件弹出广告 编辑:程序博客网 时间:2024/06/07 18:19
English,Spanish, German, French, Italian and Russian are the 6 most prominent languagesin the countries of European Union. Figure on the left shows intensity ofEnglish speaking people in different European countries. All of these languageshave different words to represent the English word “HELLO”. For example inSpanish the word equivalent to “HELLO” is “HOLA”. In German, French, Italianand Russian language the word that means (or similar to) “HELLO” is “HALLO”,“BONJOUR”, “CIAO” and “ZDRAVSTVUJTE” respectively.

 

In this problem your task ispretty simple. You will be given one of the six words mentioned above or any otherword and you will have to try and detect the language it is from.

Input

Input file contains around 2000 lines of inputs.Each line contains a stringS. You can assume that all the letters ofthe string are uppercase English letters and the maximum length of the stringis14. Input is terminated by a line containing a single ‘#’character (without the quote). This line should not be processed.

 

Output

For eachline of input except the last one produce one line of output.

This line contains the serialof output followed by a language name. If the input string is“HELLO”or “HOLA”or “HALLO”or “BONJOUR”or “CIAO”or “ZDRAVSTVUJTE”then you should report the language it belongs to. If the input string is somethingother than these 6 strings print the string“UNKNOWN”(without the quotes) instead. All characters in the output strings areuppercase as well. Look at the output for sample input for formatting details.

 

SampleInput                                Output for Sample Input

HELLO

HOLA

HALLO

BONJOUR

CIAO

ZDRAVSTVUJTE

#

 

Case 1: ENGLISH

Case 2: SPANISH

Case 3: GERMAN

Case 4: FRENCH

Case 5: ITALIAN

Case 6: RUSSIAN

 

#include<stdio.h>#include<string.h>int main(){char a[15];int count=1;while(scanf("%s",a)){if(strcmp(a,"#")==0) break;printf("Case %d: ",count++);if(strcmp(a,"HELLO")==0) puts("ENGLISH");else if(strcmp(a,"HOLA")==0) puts("SPANISH");else if(strcmp(a,"HALLO")==0) puts("GERMAN");else if(strcmp(a,"BONJOUR")==0) puts("FRENCH");else if(strcmp(a,"CIAO")==0) puts("ITALIAN");else if(strcmp(a,"ZDRAVSTVUJTE")==0) puts("RUSSIAN");else puts("UNKNOWN");}return 0;}


原创粉丝点击