Anagram words Write a C code that asks users to enter two words, one after the other and checks if these words are anagrams (permutations of the same letters). For instance, the words “smartest” and “mattress” are anagrams. Examplea Run 1:

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter9: Advanced Array Concepts
Section: Chapter Questions
Problem 2PE
icon
Related questions
Question
100%
  1. Anagram words

Write a C code that asks users to enter two words, one after the other and checks if these words are anagrams (permutations of the same letters).

For instance, the words “smartest” and “mattress” are anagrams.

Examplea

Run 1:

Please enter first word: look
please enter the second word: cool

Sorry! “cool” and “look” are not anagrams.

Run 2:

Please enter first word: masters

please enter the second word: smartes

Yes! “masters” and “smartes” are anagrams.

Hint:

  1. If you sort the two words that are anagrams, they will become identical! For instance, “smartest” and “masters” both sort to “aemrsstt”

  2. You can use all functions in <string.h>

  3. Sorting a string is exactly similar to sorting an array. You just need to know the length of the string and make sure you do not touch the terminating null.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 5 images

Blurred answer
Knowledge Booster
Mathematical functions
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning