-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathLitwo.cpp
55 lines (49 loc) · 1.71 KB
/
Litwo.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Litwo.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
int main()
{
string slowoA;
string slowoB;
string max;
string tempmax;
while (slowoA != "lolz")
{
cin >> slowoA;
cin >> slowoB;
for (int i = 0; i < slowoA.size(); i++)
{
int tempi = i;
for (int j = 0; j < slowoB.size(); j++)
{
if (slowoB[j] == slowoA[i])
{
if (i == slowoA.size())
{
break;
}
tempmax = tempmax + slowoB[j];
i++;
}
if (max.size() < tempmax.size())
{
max = tempmax;
continue;
}
}
tempmax = "";
i = tempi;
}
cout << max<<endl;
max = "";
tempmax = "";
}
return 0;
}