Question: Two.c. Must be in C! The code is given below all I need is the function sameWhenShifted. #include #include int sameWhenShifted(char *, char *); int

Two.c. Must be in C! The code is given below all I need is the function sameWhenShifted. Two.c. Must be in C! The code is given below all I

#include #include

int sameWhenShifted(char *, char *);

int main(int argc, char *argv[]) { char s1[100], s2[100]; printf("Enter string 1 : "); scanf("%s", s1); printf("Enter string 2 : "); scanf("%s", s2); int ans = sameWhenShifted(s1, s2); if ( ans != -1 ) printf("%s shifts %d to get %s ", s1, ans, s2); else printf("Cannot build %s from %s ", s2, s1); return 0; }

As an example, consider the three fles shown at the right, each having ten data values56 in them. The program is run as shown, generating the output shown in red. To make this example clearer to visualize, the values that differ on each line are shown in red. 68 6 69 68 70 65 68 ./a.out 10 Datal Data2 Data3 Datal has 2 possible bad values Data2 has 1 possible bad values Data3 has 2 possible bad values There are 1 unknown cases 2. Name this program two.c-This This program reads two strings from standard input and determines whether or not the second string can be created from the first string by shifting the characters to the left by N positions (and moving the character at beginning of the string to the end). For example, the string CDEAB can be created from ABCDE by shifting the all the characters to the left by 2 positions. If it is possible to build the second string by shifting the first string to the left by N positions, return N. Note that you can build the string ABC by shifung ABC zero locations, so return zero if the two strings are identical. If it is not possible to build the second string by shifting the first string, return -1. #include /a.out Enter string 1 : ABCDE Enter string 2: DEABC ABCDE shifts 3 to get DEABC Hinclude int sameWhenshifted (char,char int main (int argc, char argv])t char sit[100], s2 [100]; printf ("Enter string 1 :" scanf("%s", s1); printf ("Enter string 2 " scanf ("s", s2) int ans = samewhenShifted (s1, s2); if ans 1 /a.out Enter string 1 : xyz Enter string 2:YZX xYz shifts 1 to get Yzx /a.out Enter string 1: ABC Enter string 2: D get %s ", s1, an from %s ", s2, s1); printf ("is shifts td to s, s2) Cannot build D from ABC else /a.out Enter atring 1 : ABC Enter string 2: BCD Cannot build BCD from ABC printf ("Cannot build %s return 0 3. Name this linked list of words and counts certain types of words. Specifically, it counts the number of words that are either all lower-case or all upper-case letters. For example, in the li the count returned would be 2 (alabama and TIDE)

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 Databases Questions!