Cod sursa(job #536444)
| Utilizator | Data | 18 februarie 2011 17:41:01 | |
|---|---|---|---|
| Problema | Subsir | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.45 kb |
#include <iostream.h>
#include <fstream.h>
#include <string.h>
using namespace std;
char s1[500],s2[500];
int i,j,n1,n2,c,maxx,ma1;
int main(){
ifstream f("subsir.in");
ofstream g("subsir.out");
f.getline(s1, 500);
f.getline(s2, 500);
n1=strlen(s1);
n2=strlen(s2);
for(i=0 ; i<=n1; i++){
c=0;
for(j=0; j<=n2; j++)
if(s1[i]==s2[j]){
i++;
c++;
if(c>ma1){
ma1=c;
maxx=0;}
if(c==ma1)
maxx++;}}
g<<maxx;}
