SlideShare a Scribd company logo
1 of 16
Download to read offline
ACM Aleppo CPC Training
Part 1 C++ Programming Concepts
By Ahmad Bashar Eter
Strings:
• We’ve seen that the strings is a type that represent array of
characters.
• We’ve also seen that if we want to input a string we can use the
default cin with >> operator but this method input the first part of
the string until the first white space character.
• If we want to input a full line string we may use getline function.
• Note: sometimes the getline retune empty string because of some
characters in the cin buffer so in order to ensure good usage of the
function put cin.clear(); cin.ignore(); before you use getline.
• Or another method is to put the getline in while loop while the
string is empty.
• We will continue on the C++ string object and its functions.
Strings:
DescriptionFunction
Return iterator to beginningbegin
Return iterator to endend
Return length of stringlength, size
Clear stringclear
Test if string is emptyempty
Append to stringappend
Insert into stringinsert
Find content in stringfind
Erase characters from stringerase
Get C string equivalentc_str
For the full reference go to:
Sort Algorithm:
• A lot of problems can be solved easily if the input is sorted.
• So in order to sort any sequence of elements we may use the
function sort which exist in the C++ algorithms library.
• this function take 2 parameter pointer or iterator to the first
element and pointer or iterator to the end of the sequence.
• Note the end element is the first element out side the rang or the
sequence.
• Know we will take the rest of the session to solve problems.
Example 1: Cakeminator
You are given a rectangular cake, represented as an r × c grid. Each cell either has
an evil strawberry, or is empty. For example, a 3 × 4 cake may look as follows:
The cakeminator is going to eat the cake! Each time he eats, he chooses a row or
a column that does not contain any evil strawberries and contains at least one
cake cell that has not been
eaten before, and eats all the cake cells there.
He may decide to eat any number of times.
Please output the maximum number of cake
cells that the cakeminator can eat.
Solve at:
Example 1: Cakeminator
Input:
The first line contains two integers r and c (2 ≤ r, c ≤ 10), denoting the number of
rows and the number of columns of the cake. The next r lines each contains c
characters — the j-th character of the i-th line denotes the content of the cell at
row i and column j, and is either one of these:
'.' character denotes a cake cell with no evil strawberry;
'S' character denotes a cake cell with an evil strawberry.
Output:
Output the maximum number of cake cells that the cakeminator can eat.
Solve at:
Example 2: Little Elephant and Chess
The Little Elephant loves chess very much.
One day the Little Elephant and his friend decided to play chess. They've got the chess pieces
but the board is a problem. They've got an 8 × 8 checkered board, each square is painted either
black or white. The Little Elephant and his friend know that a proper chessboard doesn't have
any side-adjacent cells with the same color and the upper left cell is white. To play chess, they
want to make the board they have a proper chessboard. For that the friends can choose any
row of the board and cyclically shift the cells of the chosen row, that is, put the last (rightmost)
square on the first place in the row and shift the others one position to the right. You can run
the described operation multiple times (or not run it at all).
For example, if the first line of the board looks like that "BBBBBBWW" (the white cells of the
line are marked with character "W", the black cells are marked with character "B"), then after
one cyclic shift it will look like that "WBBBBBBW".
Help the Little Elephant and his friend to find out whether they can use any number of the
described operations to turn the board they have into a proper chessboard.
Solve at:
Example 2: Little Elephant and Chess
Input
The input consists of exactly eight lines. Each line contains exactly eight
characters "W" or "B" without any spaces: the j-th character in the i-th line
stands for the color of the j-th cell of the i-th row of the elephants' board.
Character "W" stands for the white color, character "B" stands for the black color.
Consider the rows of the board numbered from 1 to 8 from top to bottom, and
the columns — from 1 to 8 from left to right. The given board can initially be a
proper chessboard.
Output
In a single line print "YES" (without the quotes), if we can make the board a
proper chessboard and "NO" (without the quotes) otherwise.
Solve at:
Example 3: Checking the Calendar
You are given names of two days of the week.
Please, determine whether it is possible that during some non-leap year the first
day of some month was equal to the first day of the week you are given, while the
first day of the next month was equal to the second day of the week you are
given. Both months should belong to one year.
In this problem, we consider the Gregorian calendar to be used. The number of
months in this calendar is equal to 12. The number of days in months during any
non-leap year is: 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31.
Names of the days of the week are given with lowercase English letters: "monday",
"tuesday", "wednesday", "thursday", "friday", "saturday", "sunday".
Solve at:
Example 3: Checking the Calendar
Input
The input consists of two lines, each of them containing the name of exactly one
day of the week. It's guaranteed that each string in the input is from the set
"monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday".
Output
Print "YES" (without quotes) if such situation is possible during some non-leap
year. Otherwise, print "NO" (without quotes).
Solve at:
Example 4: Boy or Girl
Those days, many boys use beautiful girls' photos as avatars in forums. So it is
pretty hard to tell the gender of a user at the first glance. Last year, our hero
went to a forum and had a nice chat with a beauty (he thought so). After that
they talked very often and eventually they became a couple in the network.
But yesterday, he came to see "her" in the real world and found out "she" is
actually a very strong man! Our hero is very sad and he is too tired to love again
now. So he came up with a way to recognize users' genders by their user names.
This is his method: if the number of distinct characters in one's user name is odd,
then he is a male, otherwise she is a female. You are given the string that
denotes the user name, please help our hero to determine the gender of this
user by his method.
Solve at:
Example 4: Boy or Girl
Input
The first line contains a non-empty string, that contains only lowercase English
letters — the user name. This string contains at most 100 letters.
Output
If it is a female by our hero's method, print "CHAT WITH HER!" (without the
quotes), otherwise, print "IGNORE HIM!" (without the quotes).
Solve at:
Example 5: Amusing Joke
So, the New Year holidays are over. Santa Claus and his colleagues can take a rest and
have guests at last. When two "New Year and Christmas Men" meet, thear assistants
cut out of cardboard the letters from the guest's name and the host's name in honor of
this event. Then the hung the letters above the main entrance. One night, when
everyone went to bed, someone took all the letters of our characters' names. Then he
may have shuffled the letters and put them in one pile in front of the door.
The next morning it was impossible to find the culprit who had made the disorder. But
everybody wondered whether it is possible to restore the names of the host and his
guests from the letters lying at the door? That is, we need to verify that there are no
extra letters, and that nobody will need to cut more letters.
Help the "New Year and Christmas Men" and their friends to cope with this problem.
You are given both inscriptions that hung over the front door the previous night, and a
pile of letters that were found at the front door next morning.
Solve at:
Example 5: Amusing Joke
Input
The input file consists of three lines: the first line contains the guest's name, the
second line contains the name of the residence host and the third line contains
letters in a pile that were found at the door in the morning. All lines are not empty
and contain only uppercase Latin letters. The length of each line does not
exceed 100.
Output
Print "YES" without the quotes, if the letters in the pile could be permuted to make
the names of the "New Year and Christmas Men". Otherwise, print "NO" without
the quotes.
Solve at:
Other Exercises
Try these good exercises and remember the more you exercise, the
better you will become ;).
• Codeforces B. Pashmak and Flowers
• Codeforces A. Laptops
• Codeforces A. Wsay Too Long Words
• Codeforces A. String Task
And don’t forget to join the Facebook group:
Acm_Aleppo_CPC | Discussion
Also follow us on:
ACM ICPC Aleppo University
Thank you :) :) :)

More Related Content

Similar to Acm aleppo cpc training third session

Week 3 Homework (HW3) LANE C5 AND ILLOWSKY C3 AND C4OVERVIEW O.docx
Week 3 Homework  (HW3)  LANE C5 AND ILLOWSKY C3 AND C4OVERVIEW O.docxWeek 3 Homework  (HW3)  LANE C5 AND ILLOWSKY C3 AND C4OVERVIEW O.docx
Week 3 Homework (HW3) LANE C5 AND ILLOWSKY C3 AND C4OVERVIEW O.docx
cockekeshia
 
Museum Paper Rubric50 pointsRubric below is a chart form of .docx
Museum Paper Rubric50 pointsRubric below is a chart form of .docxMuseum Paper Rubric50 pointsRubric below is a chart form of .docx
Museum Paper Rubric50 pointsRubric below is a chart form of .docx
gilpinleeanna
 
Python Strings and its Featues Explained in Detail .pptx
Python Strings and its Featues Explained in Detail .pptxPython Strings and its Featues Explained in Detail .pptx
Python Strings and its Featues Explained in Detail .pptx
parmg0960
 
Mathematical Languages.pptx
Mathematical Languages.pptxMathematical Languages.pptx
Mathematical Languages.pptx
allanbabad4
 
C-Pubb-TestingExperience_Issue_08_2008
C-Pubb-TestingExperience_Issue_08_2008C-Pubb-TestingExperience_Issue_08_2008
C-Pubb-TestingExperience_Issue_08_2008
Berta Danilo
 
An applied approach to calculas
An applied approach to calculasAn applied approach to calculas
An applied approach to calculas
Tarun Gehlot
 

Similar to Acm aleppo cpc training third session (20)

Python data handling
Python data handlingPython data handling
Python data handling
 
Logic.pdf
Logic.pdfLogic.pdf
Logic.pdf
 
Logic.pdf
Logic.pdfLogic.pdf
Logic.pdf
 
3.1 Integers and Absolute Value
3.1 Integers and Absolute Value3.1 Integers and Absolute Value
3.1 Integers and Absolute Value
 
varthini python .pptx
varthini python .pptxvarthini python .pptx
varthini python .pptx
 
Week 3 Homework (HW3) LANE C5 AND ILLOWSKY C3 AND C4OVERVIEW O.docx
Week 3 Homework  (HW3)  LANE C5 AND ILLOWSKY C3 AND C4OVERVIEW O.docxWeek 3 Homework  (HW3)  LANE C5 AND ILLOWSKY C3 AND C4OVERVIEW O.docx
Week 3 Homework (HW3) LANE C5 AND ILLOWSKY C3 AND C4OVERVIEW O.docx
 
Permutation combination
Permutation combinationPermutation combination
Permutation combination
 
Museum Paper Rubric50 pointsRubric below is a chart form of .docx
Museum Paper Rubric50 pointsRubric below is a chart form of .docxMuseum Paper Rubric50 pointsRubric below is a chart form of .docx
Museum Paper Rubric50 pointsRubric below is a chart form of .docx
 
Basics of Counting Techniques
Basics of Counting TechniquesBasics of Counting Techniques
Basics of Counting Techniques
 
Python Strings and its Featues Explained in Detail .pptx
Python Strings and its Featues Explained in Detail .pptxPython Strings and its Featues Explained in Detail .pptx
Python Strings and its Featues Explained in Detail .pptx
 
Mathematical Languages.pptx
Mathematical Languages.pptxMathematical Languages.pptx
Mathematical Languages.pptx
 
Mathematical Statistics Homework Help
Mathematical Statistics Homework HelpMathematical Statistics Homework Help
Mathematical Statistics Homework Help
 
05 c++-strings
05 c++-strings05 c++-strings
05 c++-strings
 
Real Numbers
Real NumbersReal Numbers
Real Numbers
 
C-Pubb-TestingExperience_Issue_08_2008
C-Pubb-TestingExperience_Issue_08_2008C-Pubb-TestingExperience_Issue_08_2008
C-Pubb-TestingExperience_Issue_08_2008
 
An applied approach to calculas
An applied approach to calculasAn applied approach to calculas
An applied approach to calculas
 
Section 5 - Permutations and Combinations
Section 5 - Permutations and CombinationsSection 5 - Permutations and Combinations
Section 5 - Permutations and Combinations
 
Fundamentals of math
Fundamentals of mathFundamentals of math
Fundamentals of math
 
Mit6 006 f11_quiz1
Mit6 006 f11_quiz1Mit6 006 f11_quiz1
Mit6 006 f11_quiz1
 
Mathematical Statistics Homework Help
Mathematical Statistics Homework HelpMathematical Statistics Homework Help
Mathematical Statistics Homework Help
 

More from Ahmad Bashar Eter

More from Ahmad Bashar Eter (7)

Acm aleppo cpc training ninth session
Acm aleppo cpc training ninth sessionAcm aleppo cpc training ninth session
Acm aleppo cpc training ninth session
 
Acm aleppo cpc training eighth session
Acm aleppo cpc training eighth sessionAcm aleppo cpc training eighth session
Acm aleppo cpc training eighth session
 
Acm aleppo cpc training seventh session
Acm aleppo cpc training seventh sessionAcm aleppo cpc training seventh session
Acm aleppo cpc training seventh session
 
Acm aleppo cpc training sixth session
Acm aleppo cpc training sixth sessionAcm aleppo cpc training sixth session
Acm aleppo cpc training sixth session
 
Acm aleppo cpc training fifth session
Acm aleppo cpc training fifth sessionAcm aleppo cpc training fifth session
Acm aleppo cpc training fifth session
 
Acm aleppo cpc training second session
Acm aleppo cpc training second sessionAcm aleppo cpc training second session
Acm aleppo cpc training second session
 
Acm aleppo cpc training introduction 1
Acm aleppo cpc training introduction 1Acm aleppo cpc training introduction 1
Acm aleppo cpc training introduction 1
 

Recently uploaded

Personalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaPersonalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
EADTU
 
SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code Examples
Peter Brusilovsky
 

Recently uploaded (20)

Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptxAnalyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
 
How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17
 
Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...
 
Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.ppt
 
ESSENTIAL of (CS/IT/IS) class 07 (Networks)
ESSENTIAL of (CS/IT/IS) class 07 (Networks)ESSENTIAL of (CS/IT/IS) class 07 (Networks)
ESSENTIAL of (CS/IT/IS) class 07 (Networks)
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
 
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaPersonalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
 
Graduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxGraduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptx
 
Major project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesMajor project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategies
 
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community PartnershipsSpring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
 
ANTI PARKISON DRUGS.pptx
ANTI         PARKISON          DRUGS.pptxANTI         PARKISON          DRUGS.pptx
ANTI PARKISON DRUGS.pptx
 
An Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge AppAn Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge App
 
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
 
SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code Examples
 
The Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDFThe Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDF
 
VAMOS CUIDAR DO NOSSO PLANETA! .
VAMOS CUIDAR DO NOSSO PLANETA!                    .VAMOS CUIDAR DO NOSSO PLANETA!                    .
VAMOS CUIDAR DO NOSSO PLANETA! .
 
Observing-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxObserving-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptx
 

Acm aleppo cpc training third session

  • 1. ACM Aleppo CPC Training Part 1 C++ Programming Concepts By Ahmad Bashar Eter
  • 2. Strings: • We’ve seen that the strings is a type that represent array of characters. • We’ve also seen that if we want to input a string we can use the default cin with >> operator but this method input the first part of the string until the first white space character. • If we want to input a full line string we may use getline function. • Note: sometimes the getline retune empty string because of some characters in the cin buffer so in order to ensure good usage of the function put cin.clear(); cin.ignore(); before you use getline. • Or another method is to put the getline in while loop while the string is empty. • We will continue on the C++ string object and its functions.
  • 3. Strings: DescriptionFunction Return iterator to beginningbegin Return iterator to endend Return length of stringlength, size Clear stringclear Test if string is emptyempty Append to stringappend Insert into stringinsert Find content in stringfind Erase characters from stringerase Get C string equivalentc_str For the full reference go to:
  • 4. Sort Algorithm: • A lot of problems can be solved easily if the input is sorted. • So in order to sort any sequence of elements we may use the function sort which exist in the C++ algorithms library. • this function take 2 parameter pointer or iterator to the first element and pointer or iterator to the end of the sequence. • Note the end element is the first element out side the rang or the sequence. • Know we will take the rest of the session to solve problems.
  • 5. Example 1: Cakeminator You are given a rectangular cake, represented as an r × c grid. Each cell either has an evil strawberry, or is empty. For example, a 3 × 4 cake may look as follows: The cakeminator is going to eat the cake! Each time he eats, he chooses a row or a column that does not contain any evil strawberries and contains at least one cake cell that has not been eaten before, and eats all the cake cells there. He may decide to eat any number of times. Please output the maximum number of cake cells that the cakeminator can eat. Solve at:
  • 6. Example 1: Cakeminator Input: The first line contains two integers r and c (2 ≤ r, c ≤ 10), denoting the number of rows and the number of columns of the cake. The next r lines each contains c characters — the j-th character of the i-th line denotes the content of the cell at row i and column j, and is either one of these: '.' character denotes a cake cell with no evil strawberry; 'S' character denotes a cake cell with an evil strawberry. Output: Output the maximum number of cake cells that the cakeminator can eat. Solve at:
  • 7. Example 2: Little Elephant and Chess The Little Elephant loves chess very much. One day the Little Elephant and his friend decided to play chess. They've got the chess pieces but the board is a problem. They've got an 8 × 8 checkered board, each square is painted either black or white. The Little Elephant and his friend know that a proper chessboard doesn't have any side-adjacent cells with the same color and the upper left cell is white. To play chess, they want to make the board they have a proper chessboard. For that the friends can choose any row of the board and cyclically shift the cells of the chosen row, that is, put the last (rightmost) square on the first place in the row and shift the others one position to the right. You can run the described operation multiple times (or not run it at all). For example, if the first line of the board looks like that "BBBBBBWW" (the white cells of the line are marked with character "W", the black cells are marked with character "B"), then after one cyclic shift it will look like that "WBBBBBBW". Help the Little Elephant and his friend to find out whether they can use any number of the described operations to turn the board they have into a proper chessboard. Solve at:
  • 8. Example 2: Little Elephant and Chess Input The input consists of exactly eight lines. Each line contains exactly eight characters "W" or "B" without any spaces: the j-th character in the i-th line stands for the color of the j-th cell of the i-th row of the elephants' board. Character "W" stands for the white color, character "B" stands for the black color. Consider the rows of the board numbered from 1 to 8 from top to bottom, and the columns — from 1 to 8 from left to right. The given board can initially be a proper chessboard. Output In a single line print "YES" (without the quotes), if we can make the board a proper chessboard and "NO" (without the quotes) otherwise. Solve at:
  • 9. Example 3: Checking the Calendar You are given names of two days of the week. Please, determine whether it is possible that during some non-leap year the first day of some month was equal to the first day of the week you are given, while the first day of the next month was equal to the second day of the week you are given. Both months should belong to one year. In this problem, we consider the Gregorian calendar to be used. The number of months in this calendar is equal to 12. The number of days in months during any non-leap year is: 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31. Names of the days of the week are given with lowercase English letters: "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday". Solve at:
  • 10. Example 3: Checking the Calendar Input The input consists of two lines, each of them containing the name of exactly one day of the week. It's guaranteed that each string in the input is from the set "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday". Output Print "YES" (without quotes) if such situation is possible during some non-leap year. Otherwise, print "NO" (without quotes). Solve at:
  • 11. Example 4: Boy or Girl Those days, many boys use beautiful girls' photos as avatars in forums. So it is pretty hard to tell the gender of a user at the first glance. Last year, our hero went to a forum and had a nice chat with a beauty (he thought so). After that they talked very often and eventually they became a couple in the network. But yesterday, he came to see "her" in the real world and found out "she" is actually a very strong man! Our hero is very sad and he is too tired to love again now. So he came up with a way to recognize users' genders by their user names. This is his method: if the number of distinct characters in one's user name is odd, then he is a male, otherwise she is a female. You are given the string that denotes the user name, please help our hero to determine the gender of this user by his method. Solve at:
  • 12. Example 4: Boy or Girl Input The first line contains a non-empty string, that contains only lowercase English letters — the user name. This string contains at most 100 letters. Output If it is a female by our hero's method, print "CHAT WITH HER!" (without the quotes), otherwise, print "IGNORE HIM!" (without the quotes). Solve at:
  • 13. Example 5: Amusing Joke So, the New Year holidays are over. Santa Claus and his colleagues can take a rest and have guests at last. When two "New Year and Christmas Men" meet, thear assistants cut out of cardboard the letters from the guest's name and the host's name in honor of this event. Then the hung the letters above the main entrance. One night, when everyone went to bed, someone took all the letters of our characters' names. Then he may have shuffled the letters and put them in one pile in front of the door. The next morning it was impossible to find the culprit who had made the disorder. But everybody wondered whether it is possible to restore the names of the host and his guests from the letters lying at the door? That is, we need to verify that there are no extra letters, and that nobody will need to cut more letters. Help the "New Year and Christmas Men" and their friends to cope with this problem. You are given both inscriptions that hung over the front door the previous night, and a pile of letters that were found at the front door next morning. Solve at:
  • 14. Example 5: Amusing Joke Input The input file consists of three lines: the first line contains the guest's name, the second line contains the name of the residence host and the third line contains letters in a pile that were found at the door in the morning. All lines are not empty and contain only uppercase Latin letters. The length of each line does not exceed 100. Output Print "YES" without the quotes, if the letters in the pile could be permuted to make the names of the "New Year and Christmas Men". Otherwise, print "NO" without the quotes. Solve at:
  • 15. Other Exercises Try these good exercises and remember the more you exercise, the better you will become ;). • Codeforces B. Pashmak and Flowers • Codeforces A. Laptops • Codeforces A. Wsay Too Long Words • Codeforces A. String Task And don’t forget to join the Facebook group: Acm_Aleppo_CPC | Discussion Also follow us on: ACM ICPC Aleppo University
  • 16. Thank you :) :) :)