NMDanny

S4 - Other

Feb 3rd, 2013
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.82 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6.  
  7. namespace ConsoleApplication37
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int[] Letters=new int[26];
  14.             Console.WriteLine("Type a string");
  15.             string St = Console.ReadLine().ToLower();
  16.             int Asterick = St.IndexOf('*');
  17.             for (int i = 0; i < Asterick; ++i)
  18.             {
  19.                 int Num = ((int)St[i])-97;
  20.                 Letters[Num] =Letters[Num]+1;
  21.             }
  22.             for (int i = 0; i < Letters.Length; ++i)
  23.             {
  24.                 if (Letters[i] > 0)
  25.                 {
  26.                     Console.WriteLine("Letter {0}:{1}", (char)(i + 97), Letters[i]);
  27.                 }
  28.             }
  29.  
  30.         }
  31.        
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment