You are on page 1of 2

TEDDY AND TRACY

Y.MAHIMAMANI

2100030612

S07

ABSTRACT:

Teddy and Tracy like to play a game based on strings. The game is as follows. Initially,
Tracy writes a long random string on a white board. Then, each player starting with Teddy makes
turn alternately. Each turn, the player must erase a contiguous substring that exists in the dictionary.
Of course, the player that can't erase any substring in his turn loses the game, and the other player is
declared the winner. Note that after a substring R is erased, the remaining substring becomes
separated, i.e. they cannot erase a word that occurs partially to the left of R and partially to the
right of R.

SAMPLE INPUT:

If Tracy give as Code chef.

Teddy erase code, Tracy erase chef, teddy cannot erase any sub string so teddy loses the
game

SAMPLE OUTPUT:

The output will be as TRACY.

TOPICS NEEDED:

1.Integer Datatype:

SYNTAX: datatype variable name;

EX: int n;

2.String/character array:

SYNTAX: datatype variable name[size];

EX: char n [100];

3.loops (for loop):

SYNTAX: for (initialization; condition; increment or decrement)

Statements;

EX: for ( i=1; i <=n; i ++)

{
Statements; }

4.conditional statements:(if else)

SYNTAX:

if (condition)

Statement 1;

else

Statement 2;

EX:

If (condition)

Printf (“Teddy”);

Else

Printf (“Tracy”);

TEAM MEMBERS:

2100030612-Y. MAHIMAMANI

2100030620-Y. ROHITHA

2100030593-AISHWARYA

2100030605-VIVEK KUMAR

You might also like