using System;
using System.IO;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;


class Program
{
    static void Main()
    {
        int acceptableEmptyLines = 50;
        int foundEmptyLines = 0;
        string str = "";
        string line = "";
        while (foundEmptyLines <= acceptableEmptyLines) {
            if ((line = Console.ReadLine()) == null)
              foundEmptyLines+=1;
            else
              str+=line;
        }
        
        string unshapedUnicode = str.GetUnShapedUnicode();
        string[] separator = { "\\u" };
        while (unshapedUnicode.Length > 0)
            {
                
                string[] hexstr = unshapedUnicode.Split(separator, StringSplitOptions.RemoveEmptyEntries);
                Console.Write((separator[0].ToString()+hexstr[0]).DecodeEncodedNonAsciiCharacters() + " = ");
                int cal = 0;
                for (int j = 0; j < hexstr.Length; j++)
                {
                    if (hexstr[0] == hexstr[j])
                    {
                        cal++;
                    }
                }
                Console.WriteLine(cal);
                unshapedUnicode = unshapedUnicode.Replace(separator[0].ToString() + hexstr[0].ToString(), string.Empty);
            }
        }
}

public class UnicodeTable
    {
        private static UnicodeTable _singeltonInstance;
        private UnicodeTable()
        {
            InitializeTable();
        }

        public static Dictionary<string, string[]> GetArabicGlyphs()
        {
            if (_singeltonInstance == null)
            {
                _singeltonInstance = new UnicodeTable();
            }

            return _singeltonInstance._arabicGlyphs;
        }

        private Dictionary<string, string[]> _arabicGlyphs;
        private void InitializeTable()
        {
            //key is character shaped unicode, value is unicode of each letter's 4 cases
            _arabicGlyphs=new Dictionary<string, string[]>();
            _arabicGlyphs.Add("\\u0622", new string[] { "\\uFE81", "\\uFE81", "\\uFE82", "\\uFE82", "2" });
            _arabicGlyphs.Add("\\u0623", new string[] { "\\uFE83", "\\uFE83", "\\uFE84", "\\uFE84", "2" });
            _arabicGlyphs.Add("\\u0624", new string[] { "\\uFE85", "\\uFE85", "\\uFE86", "\\uFE86", "2" });
            _arabicGlyphs.Add("\\u0625", new string[] { "\\uFE87", "\\uFE87", "\\uFE88", "\\uFE88", "2" });
            _arabicGlyphs.Add("\\u0626", new string[] { "\\uFE89", "\\uFE8B", "\\uFE8C", "\\uFE8A", "4" });
            _arabicGlyphs.Add("\\u0627", new string[] { "\\u0627", "\\u0627", "\\uFE8E", "\\uFE8E", "2" });
            _arabicGlyphs.Add("\\u0628", new string[] { "\\uFE8F", "\\uFE91", "\\uFE92", "\\uFE90", "4" });
            _arabicGlyphs.Add("\\u0629", new string[] { "\\uFE93", "\\uFE93", "\\uFE94", "\\uFE94", "2" });
            _arabicGlyphs.Add("\\u062A", new string[] { "\\uFE95", "\\uFE97", "\\uFE98", "\\uFE96", "4" });
            _arabicGlyphs.Add("\\u062B", new string[] { "\\uFE99", "\\uFE9B", "\\uFE9C", "\\uFE9A", "4" });
            _arabicGlyphs.Add("\\u062C", new string[] { "\\uFE9D", "\\uFE9F", "\\uFEA0", "\\uFE9E", "4" });
            _arabicGlyphs.Add("\\u062D", new string[] { "\\uFEA1", "\\uFEA3", "\\uFEA4", "\\uFEA2", "4" });
            _arabicGlyphs.Add("\\u062E", new string[] { "\\uFEA5", "\\uFEA7", "\\uFEA8", "\\uFEA6", "4" });
            _arabicGlyphs.Add("\\u062F", new string[] { "\\uFEA9", "\\uFEA9", "\\uFEAA", "\\uFEAA", "2" });
            _arabicGlyphs.Add("\\u0630", new string[] { "\\uFEAB", "\\uFEAB", "\\uFEAC", "\\uFEAC", "2" });
            _arabicGlyphs.Add("\\u0631", new string[] { "\\uFEAD", "\\uFEAD", "\\uFEAE", "\\uFEAE", "2" });
            _arabicGlyphs.Add("\\u0632", new string[] { "\\uFEAF", "\\uFEAF", "\\uFEB0", "\\uFEB0", "2" });
            _arabicGlyphs.Add("\\u0633", new string[] { "\\uFEB1", "\\uFEB3", "\\uFEB4", "\\uFEB2", "4" });
            _arabicGlyphs.Add("\\u0634", new string[] { "\\uFEB5", "\\uFEB7", "\\uFEB8", "\\uFEB6", "4" });
            _arabicGlyphs.Add("\\u0635", new string[] { "\\uFEB9", "\\uFEBB", "\\uFEBC", "\\uFEBA", "4" });
            _arabicGlyphs.Add("\\u0636", new string[] { "\\uFEBD", "\\uFEBF", "\\uFEC0", "\\uFEBE", "4" });
            _arabicGlyphs.Add("\\u0637", new string[] { "\\uFEC1", "\\uFEC3", "\\uFEC4", "\\uFEC2", "4" });
            _arabicGlyphs.Add("\\u0638", new string[] { "\\uFEC5", "\\uFEC7", "\\uFEC8", "\\uFEC6", "4" });
            _arabicGlyphs.Add("\\u0639", new string[] { "\\uFEC9", "\\uFECB", "\\uFECC", "\\uFECA", "4" });
            _arabicGlyphs.Add("\\u063A", new string[] { "\\uFECD", "\\uFECF", "\\uFED0", "\\uFECE", "4" });
            _arabicGlyphs.Add("\\u0641", new string[] { "\\uFED1", "\\uFED3", "\\uFED4", "\\uFED2", "4" });
            _arabicGlyphs.Add("\\u0642", new string[] { "\\uFED5", "\\uFED7", "\\uFED8", "\\uFED6", "4" });
            _arabicGlyphs.Add("\\u0643", new string[] { "\\uFED9", "\\uFEDB", "\\uFEDC", "\\uFEDA", "4" });
            _arabicGlyphs.Add("\\u0644", new string[] { "\\uFEDD", "\\uFEDF", "\\uFEE0", "\\uFEDE", "4" });
            _arabicGlyphs.Add("\\u0645", new string[] { "\\uFEE1", "\\uFEE3", "\\uFEE4", "\\uFEE2", "4" });
            _arabicGlyphs.Add("\\u0646", new string[] { "\\uFEE5", "\\uFEE7", "\\uFEE8", "\\uFEE6", "4" });
            _arabicGlyphs.Add("\\u0647", new string[] { "\\uFEE9", "\\uFEEB", "\\uFEEC", "\\uFEEA", "4" });
            _arabicGlyphs.Add("\\u0648", new string[] { "\\uFEED", "\\uFEED", "\\uFEEE", "\\uFEEE", "2" });
            _arabicGlyphs.Add("\\u0649", new string[] { "\\uFEEF", "\\uFEEF", "\\uFEF0", "\\uFEF0", "2" });
            _arabicGlyphs.Add("\\u0671", new string[] { "\\u0671", "\\u0671", "\\uFB51", "\\uFB51", "2" });
            _arabicGlyphs.Add("\\u064A", new string[] { "\\uFEF1", "\\uFEF3", "\\uFEF4", "\\uFEF2", "4" });
            _arabicGlyphs.Add("\\u066E", new string[] { "\\uFBE4", "\\uFBE8", "\\uFBE9", "\\uFBE5", "4" });
            _arabicGlyphs.Add("\\u06AA", new string[] { "\\uFB8E", "\\uFB90", "\\uFB91", "\\uFB8F", "4" });
            _arabicGlyphs.Add("\\u06C1", new string[] { "\\uFBA6", "\\uFBA8", "\\uFBA9", "\\uFBA7", "4" });
            _arabicGlyphs.Add("\\u06E4", new string[] { "\\u06E4", "\\u06E4", "\\u06E4", "\\uFEEE", "2" });
        }

    }
    
    public static class Unshaper
    {
        public static string GetAsUnicode(this string shapedText)
        {
            shapedText = Regex.Unescape(shapedText.Trim());
            var words = shapedText.Split(' ');
            StringBuilder builder = new StringBuilder();
            foreach (var word in words)
            {
                for (int i = 0; i < word.Length; i++)
                {
                    string shapedUnicode = @"\u" + ((int)word[i]).ToString("X4");
                    builder.Append(shapedUnicode);
                }
            }
            return builder.ToString();
        }

        public static string GetUnShapedUnicode(this string original)
        {
            //remove escape characters
            original = Regex.Unescape(original.Trim());

            var words = original.Split(' ');
            StringBuilder builder = new StringBuilder();
            var unicodeTable = UnicodeTable.GetArabicGlyphs();
            foreach (var word in words)
            {
               string previous = null;
                string unicodeToAppend;
                //int index = 0;                
                string lamShapedUnicode = "\\u0644";
                string alefShapedUnicode = "\\u0627";
                string lamAlefShapedUnicode = "\\uFEFB";
                string lamConnectedAlefShapedUnicode = "\\uFEFC";
                string nextShapedUnicode;
                bool lamAlefDetected = false;
                

                //foreach (var character in word)
                for (int index = 0; index < word.Length; index++)
                {
                    string shapedUnicode = @"\u" + ((int)word[index]).ToString("X4");

                    //get next character to check for special lam alif, if not last character
                    if (shapedUnicode == lamShapedUnicode && (index != word.Length - 1))
                    {
                        nextShapedUnicode = @"\u" + ((int)word[index + 1]).ToString("X4");
                        if (nextShapedUnicode == alefShapedUnicode)
                        {
                            //builder.Append(lamAlefShapedUnicode);
                            ////previous = null;
                            //index++; //skip the next character alef since it's been counted
                            //continue;

                            lamAlefDetected = true;
                        }
                    }

                    //if unicode doesn't exist in unicode table then character isn't a letter hence shaped unicode is fine
                    if (!unicodeTable.ContainsKey(shapedUnicode))
                    {
                        builder.Append(shapedUnicode);
                        previous = null;                        
                        continue;
                    }
                    else
                    {
                        //first character in word or previous character isn't a letter
                        if (index == 0 || previous == null)
                        {
                            unicodeToAppend = unicodeTable[shapedUnicode][1];
                        }
                        else
                        {
                            bool previousCharHasOnlyTwoCases = unicodeTable[previous][4] == "2";
                            //if last character in word
                            if (index == word.Length - 1)
                            {
                                if (!string.IsNullOrEmpty(previous) && previousCharHasOnlyTwoCases)
                                {
                                    unicodeToAppend = unicodeTable[shapedUnicode][0];
                                }
                                else
                                    unicodeToAppend = unicodeTable[shapedUnicode][3];
                            }
                            //character in middle of word
                            else
                            {
                                if (previousCharHasOnlyTwoCases)
                                    unicodeToAppend = unicodeTable[shapedUnicode][1];
                                else
                                    unicodeToAppend = unicodeTable[shapedUnicode][2];

                            }
                        }

                        //check for lam alef to append the right unicode
                        if (lamAlefDetected)
                        {
                            index++; //make sure to skip counting the alef

                            if (unicodeToAppend == unicodeTable[shapedUnicode][0] || unicodeToAppend == unicodeTable[shapedUnicode][1]) //forms of lam that are not connected
                                unicodeToAppend = lamAlefShapedUnicode;
                            else
                                unicodeToAppend = lamConnectedAlefShapedUnicode;
                        }


                        builder.Append(unicodeToAppend);
                    }

                    previous = shapedUnicode;
                    lamAlefDetected = false;
                    //index++;
                }
                //if not last word then add a space unicode
                if (words.ToList().IndexOf(word) != words.Length - 1)
                    builder.Append(@"\u" + ((int)' ').ToString("X4"));
            }

            return builder.ToString();
        }
        public static string DecodeEncodedNonAsciiCharacters(this string value)
        {
            return Regex.Replace(
                value,
                @"\\u(?<Value>[a-zA-Z0-9]{4})",
                m => ((char)int.Parse(m.Groups["Value"].Value, NumberStyles.HexNumber)).ToString());
        }
    } 
by

C Sharp Online Compiler

Write, Run & Share C# code online using OneCompiler's C# online compiler for free. It's one of the robust, feature-rich online compilers for C# language, running on the latest version 8.0. Getting started with the OneCompiler's C# compiler is simple and pretty fast. The editor shows sample boilerplate code when you choose language as C# and start coding.

Read inputs from stdin

OneCompiler's C# online compiler supports stdin and users can give inputs to programs using the STDIN textbox under the I/O tab. Following is a sample program which takes name as input and print your name with hello.

using System;
 
namespace Sample
{
  class Test
    {
      public static void Main(string[] args)
       {
         string name;
         name = Console.ReadLine();
         Console.WriteLine("Hello {0} ", name);
	}
     }
}

About C Sharp

C# is a general purpose object-oriented programming language by Microsoft. Though initially it was developed as part of .net but later it was approved by ECMA and ISO standards.

You can use C# to create variety of applications, like web, windows, mobile, console applications and much more using Visual studio.

Syntax help

Data types

Data TypeDescriptionRangesize
intTo store integers-2,147,483,648 to 2,147,483,6474 bytes
doubleto store large floating point numbers with decimalscan store 15 decimal digits8 bytes
floatto store floating point numbers with decimalscan store upto 7 decimal digits4 bytes
charto store single characters-2 bytes
stringto stores text-2 bytes per character
boolto stores either true or false-1 bit

Variables

Syntax

datatype variable-name = value;

Loops

1. If-Else:

When ever you want to perform a set of operations based on a condition or set of few conditions IF-ELSE is used.

if(conditional-expression) {
   // code
} 
else {
   // code
}

You can also use if-else for nested Ifs and If-Else-If ladder when multiple conditions are to be performed on a single variable.

2. Switch:

Switch is an alternative to If-Else-If ladder.

switch(conditional-expression) {    
case value1:    
 // code    
 break;  // optional  
case value2:    
 // code    
 break;  // optional  
...    
    
default:     
 // code to be executed when all the above cases are not matched;    
} 

3. For:

For loop is used to iterate a set of statements based on a condition.

for(Initialization; Condition; Increment/decrement) {
  // code  
} 

4. While:

While is also used to iterate a set of statements based on a condition. Usually while is preferred when number of iterations are not known in advance.

while(condition) {
 // code 
}

5. Do-While:

Do-while is also used to iterate a set of statements based on a condition. It is mostly used when you need to execute the statements atleast once.

do {
  // code 
} while (condition);

Arrays

Array is a collection of similar data which is stored in continuous memory addresses. Array values can be fetched using index. Index starts from 0 to size-1.

Syntax

data-type[] array-name;

Methods

Method is a set of statements which gets executed only when they are called. Call the method name in the main function to execute the method.

Syntax

static void method-name() 
{
  // code to be executed
}