#include <stdio.h> #include <ctype.h> #include <math.h> #include <conio.h> #include <string.h> #include <stdlib.h> int summ (char *s1) { char*p; int first = 0, T; p = s1; do { while( *p && !(isdigit(*p)) ) ++p; sscanf(p, "%d", &T); first += T; while(isdigit(*p)) ++p; } while(*p); return first; } int max (char *s2) { char*p; int T,tekmax=0; p = s2; do { while( *p && !(isdigit(*p)) ) ++p; sscanf(p, "%d", &T); if (T > tekmax) {tekmax=T;} while(isdigit(*p)) ++p; } while(*p); return tekmax; } int main () { int n; do { printf ("Enter N\n"); scanf ("%d",&n); if (n>80) {printf("error");} } while (n>80); char *s1, *s2; s1=(char*)malloc(n*sizeof(char)); s2=(char*)malloc(n*sizeof(char)); fflush(stdin); printf("enter string 1\n"); gets (s1); printf("enter string 2\n"); gets (s2); if (max(s2)>summ(s1)) { printf("Found!"); } else { printf("NOT FOUND!!!"); } return 0; }