Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <limits.h>
- #include <string.h>
- int main()
- {
- char string[100];
- char string2[100];
- printf("Enter the sentence: ");
- fgets(string,sizeof(string),stdin);
- strcpy(string2,string);
- int minlenth = INT_MAX;
- char *a = strtok(string," ,.");
- char *firstword = a;
- while (a != NULL){
- if (minlenth>strlen(a)){
- minlenth = strlen(a);
- }
- a = strtok(NULL, " ,.\n");
- }
- printf("Min length: %d\n", minlenth);
- printf("%s", strupr(firstword));
- for (int i=strlen(firstword);i<strlen(string2);i++){
- printf("%c", string2[i]);
- if (string2[i]==' '){
- printf(" ");
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement