Question: In this assignment, you are asked to implement a program that recognizes interesting patterns for any given string. In an infnite loop, the program receives

In this assignment, you are asked to implement a program that recognizes interesting
patterns for any given string. In an infnite loop, the program receives a single line from
standard input (you may use fgets(line,1000, stdin) to receive such line where line is a char
array of length 1000). The program must be interested in fnding one or more of the following
special patterns in the input string:
I. Singleton: A singleton string is made of only one letter. Examples: mmmmm, qqqqqqq,
rr, s, yyy
II. Arithmetic: A string made of subsequent alphabetical letters that appear in the alphabetical order. Examples: bcdef, pqrstuvwx, jk, y
III. Reverse Arithmetic: A string made of subsequent alphabetical letters that appear
in the reverse alphabetical order. Example: fedcb, xwvutsrqp, kj, y
IV. Balanced Tripartite: A string made of three identical parts. Example: busbusbus,
laptoplaptoplaptop, zzz
V. Balanced Bipartite: A string made of two identical halves. Examples: ticktick,
hophop, tantan, nocknock, nn
VI. Palindrome: A palindrome reads the same backward as forward. Examples: abcba,
bob, g
Please note that the above list is ranked in the decreasing order of their rarity. You
program prints out the list of all patterns (that can be found for each input string) followed
by a new line. Then, it asks for another line from input stream in a repetitive fashion. If no
pattern is found for an input string, the program prints a new line only.
For example, consider the following string received from the input stream:
bbbbbb
This string is a singleton, balanced tripartite, balanced bipartite, and a palindrome. Therefore, the program must print the following:
singleton
balanced tripartite
balanced bipartite
palindrome
please solve all patterns and separate them by files showing which is .h or .c or file to check the pattern

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!