Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <ctype.h>
- /* run this program using the console pauser or add your own getch, system("pause") or input loop */
- int main(int argc, char *argv[])
- {
- char S[100],*B[100];
- int dem=0;
- gets(S);
- for(B[dem]=strtok(S," ");B[dem]!=NULL;B[++dem]=strtok(NULL," "))
- {
- }
- int C[100],dem1=0,i;
- for(i=0;i<dem;i++)
- {
- C[dem1]=strlen(B[i]);
- dem1++;
- }
- int max=C[0];
- for(i=0;i<dem1;i++)
- {
- if(max<C[i])
- {
- max=C[i];
- }
- }
- int min;
- min=C[0];
- for(i=0;i<dem1;i++)
- {
- if(min>C[i])
- {
- min=C[i];
- }
- }
- for(i=0;i<dem;i++)
- {
- if(max==strlen(B[i]))
- {
- printf("%s ",B[i]);
- break;
- }
- }
- for(i=0;i<dem;i++)
- {
- if(min==strlen(B[i]))
- {
- printf("%s",B[i]);
- break;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement