Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #define MAX 100
- //ne menuvaj!
- void wtf() {
- FILE *f = fopen("vlez.txt", "w");
- char c;
- while((c = getchar()) != '#') {
- fputc(c, f);
- }
- fclose(f);
- }
- int main() {
- wtf();
- int x, y, br=0;
- char s[100], k[100];
- scanf("%d %d", &x, &y);
- scanf("%s", s);
- FILE *f = fopen("vlez.txt", "r");
- // vashiot kod ovde
- while(fgets(k,100,f)!=NULL){
- int i=x;
- int j=0;
- char p[strlen(s)];
- char g[strlen(s)];
- for(i=x;i<x+strlen(s);i++){
- p[j]=k[i];
- j++;
- }
- if(strlen(p)>strlen(s)){
- for(i=0;i<strlen(s);i++){
- g[i]=p[i];
- }
- }
- else{
- for(i=0;i<strlen(s);i++){
- g[i]=p[i];
- }
- }
- //printf("%s\n", p);
- if(strcmp(s,g)==0){
- for(i=x;i<=y;i++){
- printf("%c", k[i]);
- }
- br++;
- printf("\n");
- }
- }
- printf("%d", br);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement