Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <ctype.h>
- // ne menuvaj ovde
- void wtf() {
- FILE *f = fopen("dat.txt", "w");
- char c;
- while((c = getchar()) != EOF) {
- fputc(c, f);
- }
- fclose(f);
- }
- int main() {
- wtf();
- // vasiot kod ovde
- char red[101],maxred[101];
- int i,prva,posledna,maxprva,maxposledna,max=-1;
- FILE *vlez;
- vlez=fopen("dat.txt","r");
- if(vlez==NULL) {
- printf("Greska");
- return -1;
- }
- while(fgets(red,100,vlez)!=NULL) {
- for(i=0; i<strlen(red); i++)
- if(isdigit(red[i])) {
- prva=i;
- break;
- }
- for(i=0; i<strlen(red); i++)
- if(isdigit(red[i]))
- posledna=i;
- if(posledna-prva>=max) {
- max=posledna-prva;
- strcpy(maxred,red);
- maxprva=prva;
- maxposledna=posledna;
- }
- }
- for(i=maxprva; i<=maxposledna; i++)
- printf("%c",maxred[i]);
- fclose(vlez);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement