using System.Collections.Generic;
public static void palindrome(String str)
for(int i = str.Length-1; i>=0; i-- )
Console.WriteLine(str[i]);
public static Boolean parenthesescheck(String str)
Stack<String> stack = new Stack<String>();
for (int i=0;i<str.Length;i++)
if(str[i]=='{'|| str[i]=='[' || str[i]=='(' )
stack.Push(str[i].ToString());
Console.WriteLine("Pushing {0}",str[i]);
else if (str[i]=='}'|| str[i]==')' || str[i]==']' )
Console.WriteLine("Popping {0}",str[i]);
public static Boolean checkAnagram(String sr,String sv)
if (sr.Length != sv.Length)
for(int i=0; i<sr.Length;i++)
if(sv.IndexOf(sr[i])!=-1)
sv.Remove(sv.IndexOf(sr[i]));
public static void countoccurence(String s,String scom)
for(int i=0;i<scom.Length;i++)
Console.WriteLine("The element {0} appears {1} times",s,ctr);
public static string recpalindrome(String str)
return recpalindrome(str.Substring(1))+str[0];
public static void Main()
Console.WriteLine("Hello World");
String s = recpalindrome("malayalaa");
countoccurence("s","spectroscopes");
Boolean blnresult = checkAnagram("acres","cares");
Console.WriteLine("Its an Anagram");
Console.WriteLine("Not an Anagram");
string[] arr2 = { "one", "two", "three" };
Console.WriteLine(arr2[2]);
blnResult = parenthesescheck("[{()}]");
Console.WriteLine("Its balanced");
Console.WriteLine("Not balanced");