Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*1.
- országnév:zászló_színe_1:zászló_színe_2:...:zászló_méret_1:zászló_méret_2
- ...
- Beolvasol sorokat, kiíratod, hogy melyikben van a legtöbb szín és mennyi
- */
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- int main()
- {
- char *sor, *tok;
- char orszag[50], max_orszag[50];
- int db, max=-1;
- sor=malloc(10000000);
- while (gets(sor)){
- db=0;
- tok=strtok(sor, ":");
- strcpy(orszag, tok);
- while (tok=strtok(NULL, ":")){
- db++;
- }
- if (max==-1 || max<db){
- max=db;
- strcpy(max_orszag, orszag);
- }
- }
- puts(max_orszag);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement