Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- int main()
- {
- int i,j;
- char sor[301];
- while (gets(sor) != NULL)
- {
- int count=0;
- for (i=0;i<strlen(sor);++i)
- if (sor[i] == '|')
- count++;
- if (count == 2)
- printf("0\n");
- else
- {
- int t[count];
- int k=0;
- strtok(sor, "|");
- for (j=0;j<count;j++)
- {
- char szam[sizeof(int)];
- strcpy(szam,strtok(NULL,"|"));
- t[j]=atoi(szam);
- }
- int max1 = t[0], max2 = 0, max3 = 0;
- for (i = 1; i < count; i++)
- if (t[i] > max1)
- max1 = t[i];
- for (i = 0; i < count; i++)
- if (t[i] > max2 && t[i] < max1)
- max2 = t[i];
- for (i = 0; i < count; i++)
- if (t[i] > max3 && t[i] < max2)
- max3 = t[i];
- printf("%d\n",max3);
- }
- }
- return EXIT_SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement