Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- #include <iostream>
- #include <string.h>
- #include <string>
- using namespace std;
- int main()
- {
- int n, v = 0;
- char a[256];
- int Lst[50][50];
- char word[20][256];
- int i = 0;
- bool ne = false;
- string temp;
- ifstream fd("masina.in");
- ofstream fr("masina.out");
- fd >> n;
- fd.ignore(256,'\n');
- while(!fd.eof()) {
- i++;
- fd.getline(a,256);
- temp = a;
- strcpy(word[i],a);
- cout << word[i] << endl;
- //temp = word[i];
- //cout << temp.size();
- }
- for (int j = 1; j <= n ; j++){
- for(int k = 1; k <= n; k++) {
- Lst[j][k] = 0;
- }}
- for (int j = 1; j <= n; j++) {
- temp = word[j];
- //cout << temp.size();
- for (int k = j+1; k <= n; k ++){
- for (int l = 0; l <= temp.size(); l++) {
- if (word[j][l] == word[k][l] && k != j) {
- //cout << word[j][l] << " " << word[j] << " " << word[k][l] << " " << word[k] << endl;
- Lst[j][k] ++;
- cout << Lst[j][k]<< " " << j << " " << k << endl;
- }
- else {cout << Lst[j][k]<< " " << j << " " << k << endl;
- break;
- }
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement