100% found this document useful (1 vote)
333 views2 pages

Teddy and Tracy

The document describes a string game played between Teddy and Tracy. Tracy writes a random string on a whiteboard. Players take turns erasing substrings from the string if they exist in the dictionary. The player unable to erase a substring loses. Teddy erases "code" from the sample input "Code chef". Tracy then erases "chef". Teddy is unable to erase any more substrings, so Teddy loses. The output would be "TRACY". The document lists integer datatypes, strings, for loops, and if/else statements as topics needed to code this game.

Uploaded by

Mahima Chowdary
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
333 views2 pages

Teddy and Tracy

The document describes a string game played between Teddy and Tracy. Tracy writes a random string on a whiteboard. Players take turns erasing substrings from the string if they exist in the dictionary. The player unable to erase a substring loses. Teddy erases "code" from the sample input "Code chef". Tracy then erases "chef". Teddy is unable to erase any more substrings, so Teddy loses. The output would be "TRACY". The document lists integer datatypes, strings, for loops, and if/else statements as topics needed to code this game.

Uploaded by

Mahima Chowdary
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 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