maximkustreev

Untitled

Apr 15th, 2012
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.78 KB | None | 0 0
  1. using System;
  2. using System.Collections;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace ConsoleApplication2
  7. {
  8.     class Program
  9.     {
  10.          static void Main(string[] args)
  11.         {
  12.             string words;
  13.             Console.WriteLine("Введите строку");
  14.             words=Console.ReadLine();
  15.  
  16.             ArrayList m = new ArrayList();
  17.             foreach(char wo in words){ m.Add(wo); }
  18.  
  19.             ArrayList a = new ArrayList();
  20.              a.Add("a"); a.Add("b"); a.Add("c"); a.Add("d"); a.Add("e"); a.Add("f"); a.Add("g");
  21.              a.Add("h"); a.Add("i"); a.Add("j"); a.Add("k"); a.Add("l"); a.Add("m"); a.Add("n");
  22.              a.Add("o"); a.Add("p"); a.Add("q"); a.Add("r"); a.Add("s"); a.Add("t"); a.Add("u");
  23.              a.Add("v"); a.Add("w"); a.Add("x"); a.Add("y"); a.Add("z");
  24.  
  25.              Console.WriteLine("Исходный текст: ");
  26.              foreach (char mm in m) { Console.Write(mm); }
  27.              Console.WriteLine();
  28.  
  29.             for (int k = 0; k <= a.Count-1; k++)
  30.             {
  31.                 ArrayList tmp = new ArrayList();
  32.                 string str = (string)a[k];
  33.                 int i = 0, x = -1, count = -1;
  34.                 while (i != -1)
  35.                 {
  36.                     foreach(char strr in str)
  37.                     i = m.IndexOf(strr, x + 1);
  38.                     x = i;
  39.                     count++;
  40.                    
  41.                 }
  42.                 tmp.Add(count);
  43.  
  44.  
  45.                 if (a.Equals(m[0]) == true) { Console.WriteLine(""); }
  46.                
  47.  
  48.               //  foreach(int tmpp in tmp)
  49.               //  Console.WriteLine("{0} - {1}", tmpp, a[k]);
  50.                
  51.                
  52.             }
  53.            
  54.            
  55.             Console.ReadKey();
  56.         }
  57.     }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment