Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please help solve this program in C: This C program accepts numbers on the command line and finds all possible assignments of upper-case letters to

please help solve this program in C:

This C program accepts numbers on the command line and finds all possible assignments of upper-case letters to each digit of numbers so that the resultant words are in an upper-case version of dictionary.txt. Note that, in a valid solution, a letter can only have one numeric value in the range 0 .. 9 associated with it and a digit can only be assigned to one letter. Given r distinct digits in the sequence of numbers there 26! / (26 - r)! possible permutations of assigning letters to numbers. Some examples are: __________________________________________________ Input: ./a.out 9567 1085 10652. Output: Found 68013 solutions, CPU Time = 0.428983, Dictionary Look Ups = 5410962 Possible Permutations = 6.2990928e+10, Actual Completed Permutations = 3494100 (0.005547%) Note: A sample solution where D = 7, E = 5, M = 1, N = 6, O = 0, R = 8, S = 9 and Y = 2 is: SEND MORE MONEY. ___________________________________________________________________________________ Input: ./a.out 67432 704 8046 97364 173546 Output: Found 973 solutions, CPU Time = 0.638096, Dictionary Look Ups = 8210204 Possible Permutations = 1.9275224e+13, Actual Completed Permutations = 178398 (0.000001%)

more examples:

Note: A sample solution where A = 7, E = 6, F = 8, H = 2, I = 0, N = 1, R = 4, T = 3, U = 5 and W = 9 is: EARTH, AIR, FIRE, WATER and NATURE. ___________________________________________________________________________________ Input: ./a.out 127503 502351 3947539 46578 4623971 Output: Found 0 solutions, CPU Time = 0.695170, Dictionary Look Ups = 8149500 Possible Permutations = 1.9275224e+13, Actual Completed Permutations = 0 (0.000000%) ___________________________________________________________________________________ Input: ./a.out 12345 54321 Output: Found 104 solutions, CPU Time = 0.757589, Dictionary Look Ups = 7899225 Possible Permutations = 2.8405900e+07, Actual Completed Permutations = 7893600 (27.788593%)

Input: ./a.out 0110 Output: Found 12 solutions, CPU Time = 0.000126, Dictionary Look Ups = 650 Possible Permutations = 3.8004924e+07, Actual Completed Permutations = 650 (0.001710%

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction to Wireless and Mobile Systems

Authors: Dharma P. Agrawal, Qing An Zeng

4th edition

1305087135, 978-1305087132, 9781305259621, 1305259629, 9781305537910 , 978-130508713

More Books

Students also viewed these Programming questions

Question

discuss the considerations in global brand strategy

Answered: 1 week ago

Question

7 m + 5 n = 4

Answered: 1 week ago