Question: Programming Assignment in C In this assignment, you are asked to implement a program that recognizes interesting patterns for any given string. In an infnite

Programming Assignment in C
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 alpha-
betical 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. There-
fore, the program must print the following:
singleton
balanced tripartite
balanced bipartite
palindrome
Submissions
You need to submit a .zip fle conmpressing the following fles:
the C source fle(s) related to the assignment (.c fles)
header fles (.h fles)
the makefle Please use pattern fnder to name the executable of your pro-
gram in the makefle. Not including the makefle, or submitting a wrong one will
reduce your score by 20%.
a snapshot of your device running gdb on the program. (.png or .jpg fles only)

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!