2011 Canadian Computing Competition, Stage 1

Problem S1: English or French?

You would like to do some experiments in natural language processing. Natural language processing (NLP) involves using machines to recognize human languages.

Your first idea is to write a program that can distinguish English text from French text.

After some analysis, you have concluded that a very reasonable way of distinguishing these two languages is to compare the occurrences of the letters "t" and "T" to the occurrences of the letters "s" and "S". Specifically:

  • if the given text has more "t" and "T" characters than "s" and "S" characters, we will say that it is (probably) English text;
  • if the given text has more "s" and "S" characters than "t" and "T" characters, we will say that it is (probably) French text;
  • if the number of "t" and "T" characters is the same as the number of "s" and "S" characters, we will say that it is (probably) French text.

Input Format

The input will contain the number N (0 < N < 10000) followed by N lines of text, where each line has at least one character and no more than 100 characters.

Output Format

Your output will be one line. This line will either consist of the word English (indicating the text is probably English) or French (indicating the text is probably French).

Sample Cases


The red cat sat on the mat.
Why are you so sad cat?
Don't ask that.




Lorsque j'avais six ans j'ai vu, une fois,
une magnifique image,
dans un livre



All Submissions
Best Solutions

Point Value: 5
Time Limit: 2.00s
Memory Limit: 16M
Added: Mar 01, 2011

Languages Allowed:

Comments (Search)

I just made an account on Peg judge and im already disappointed, u guys have no control over comments. Like why tf is this comment thread so long.

I suppose people had a lot to say

1. This question is straightforward.
2. Copying code is heavily frowned upon.

How curious, then, that you and girishir2004 seem to have independently come up with near-identical code.


BTW, if I'm not mistaken, I made my submission BEFORE royanitra04. And my name is girishr2004, not girishir2004

Typo, sorry.

And yes, you did. However, as you will likely learn as you progress through the education system, in an instance of plagiarism, all parties are punished. This is why you don't publish your CS assignment solutions in university -- because if somebody copies you three years later, you can lose credit for the course.

Previous poster: I suggest you take this to your PEG leaders. I've taken over this comment to hopefully save you from retribution.

Quick note: I for one believe in rehabilitation. I don't really care if you cheat once and never do it again. It's far better to make a mistake and learn from it in my opinion than to irreversibly punish somebody who's learned their lesson.

Thanks. And don't we all agree, royanitra04 shou1d be banned. And yes, 1 have took this to my P3G leaders.

I agree to ban anitra.
don't cheat

Plz ban Anitra the cheater!!!
Ban him
Ban him
plz plz plz

reminder don't cheat

BAN ANITRA!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Ban the cheater
ban anitra
plz plz plz with a cherry on top plz
Anitra has to go down
ban him


may this be a lesson to all:
just don't

please do not cheat
just don't do it
it is bad

my code is getting all the samples right, but when I submit, I get 12/15. Help?

Please think carefully about exactly what it is that is happening on lines 11 and 12. In fact, it is more surprising that your code passes 4/5 cases. Be careful with your variables and what they are storing at what times!

Why am I failing the third test case?????

Your code... doesn't actually look like it should work at all. I'm honestly pretty surprised you got 12/15. Think carefully about what's happening to your index variable.

It just doesn't work. Read your code again; you're clobbering variables.

I suggest making an effort to figure out what's wrong with your code before asking for help. Otherwise, you may find a less than lukewarm response.

On most of my recent codes, I get either 6/15 or 9/15. Please let me know what is wrong with code. Thank you.

int n; cin >> n; does not read the first newline character. So your first call of getline(cin, line) reads the newline character on the first line which means you missed reading the last line of input.