Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.IO;
- namespace zad2_ps3
- {
- class Program
- {
- static void Main(string[] args)
- {
- char[] slowoA = new char[256];
- char[] slowoB = new char[256];
- // string text;
- //string[] rozdzielonyText;
- // int dlugosc;
- //int[] tablica;
- List <char> list = new List<char>();
- StreamWriter sw = new StreamWriter("out.txt");
- //using (FileStream fs = File.OpenRead("in.txt"))
- //{
- // StreamReader sr = new StreamReader(fs);
- // text = sr.ReadLine();
- // rozdzielonyText = text.Split();
- // dlugosc = rozdzielonyText.Length;
- // tablica = new int[dlugosc];
- // for (int i = 0; i < dlugosc; i++)
- // {
- // tablica[i] = Convert.ToInt32(rozdzielonyText[i]);
- // }
- //}
- if (slowoA.Length>slowoB.Length)
- {
- for(int i=0; i<slowoA.Length;i++)
- {
- for (int j = 0; j < slowoB.Length; j++)
- {
- if (slowoA[i] == slowoB[j])
- {
- list.Add(slowoA[i]);
- slowoA[i] = ('0');
- slowoB[j] = ('0');
- }
- }
- }
- }
- else for (int i = 0; i < slowoB.Length; i++)
- {
- for (int j = 0; j < slowoA.Length; j++)
- {
- if (slowoB[i] == slowoA[j])
- {
- list.Add(slowoB[i]);
- slowoA[i] = ('0');
- slowoB[j] = ('0');
- }
- }
- }
- sw.Write(list);
- sw.Close();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement