codeparrot/xlcost-text-to-code huggingface dataset:
Print nodes at k distance from root | c # program to print nodes at k distance from root ; A binary tree node has data , pointer to left child and a pointer to right child ; Driver program to test above functions ; Constructed binary tree is 1 / \ 2 3 / \ / 4 5 8
using System ; public class Node { public int data ; public Node left , right ; public Node ( int item ) { data = item ; left = right = null ; } } public class BinaryTree { public Node root ; public virtual void printKDistant ( Node node , int k ) { if ( node == null k < 0 ) { return ; } if ( k == 0 ) { Console . Write ( node . data + " ▁ " ) ; return ; } printKDistant ( node . left , k - 1 ) ; printKDistant ( node . right , k - 1 ) ; } public static void Main ( string [ ] args ) { BinaryTree tree = new BinaryTree ( ) ; tree . root = new Node ( 1 ) ; tree . root . left = new Node ( 2 ) ; tree . root . right = new Node ( 3 ) ; tree . root . left . left = new Node ( 4 ) ; tree . root . left . right = new Node ( 5 ) ; tree . root . right . left = new Node ( 8 ) ; tree . printKDistant ( tree . root , 2 ) ; } }
Print nodes at k distance from root | Iterative | C # program to print all nodes of level k iterative approach ; Node of binary tree ; Function to add a new node ; Function to print nodes of given level ; extra null is added to keep track of all the nodes to be added before level is incremented by 1 ; print when level is equal to k ; break the loop if level exceeds the given level number ; Driver code ; create a binary tree
using System ; using System . Collections . Generic ; class GFG { public class Node { public int data ; public Node left , right ; } static Node newNode ( int data ) { Node newnode = new Node ( ) ; newnode . data = data ; newnode . left = newnode . right = null ; return newnode ; } static Boolean printKDistant ( Node root , int klevel ) { Queue < Node > q = new Queue < Node > ( ) ; int level = 1 ; Boolean flag = false ; q . Enqueue ( root ) ; q . Enqueue ( null ) ; while ( q . Count > 0 ) { Node temp = q . Peek ( ) ; if ( level == klevel && temp != null ) { flag = true ; Console . Write ( temp . data + " ▁ " ) ; } q . Dequeue ( ) ; if ( temp == null ) { if ( q . Count > 0 && q . Peek ( ) != null ) q . Enqueue ( null ) ; level += 1 ; if ( level > klevel ) break ; } else { if ( temp . left != null ) q . Enqueue ( temp . left ) ; if ( temp . right != null ) q . Enqueue ( temp . right ) ; } } Console . Write ( " STRNEWLINE " ) ; return flag ; } public static void Main ( String [ ] srga ) { Node root = newNode ( 20 ) ; root . left = newNode ( 10 ) ; root . right = newNode ( 30 ) ; root . left . left = newNode ( 5 ) ; root . left . right = newNode ( 15 ) ; root . left . right . left = newNode ( 12 ) ; root . right . left = newNode ( 25 ) ; root . right . right = newNode ( 40 ) ; Console . Write ( " data ▁ at ▁ level ▁ 1 ▁ : ▁ " ) ; Boolean ret = printKDistant ( root , 1 ) ; if ( ret == false ) Console . Write ( " Number ▁ exceeds ▁ total ▁ " + " number ▁ of ▁ levels STRNEWLINE " ) ; Console . Write ( " data ▁ at ▁ level ▁ 2 ▁ : ▁ " ) ; ret = printKDistant ( root , 2 ) ; if ( ret == false ) Console . Write ( " Number ▁ exceeds ▁ total ▁ " + " number ▁ of ▁ levels STRNEWLINE " ) ; Console . Write ( " data ▁ at ▁ level ▁ 3 ▁ : ▁ " ) ; ret = printKDistant ( root , 3 ) ; if ( ret == false ) Console . Write ( " Number ▁ exceeds ▁ total ▁ " + " number ▁ of ▁ levels STRNEWLINE " ) ; Console . Write ( " data ▁ at ▁ level ▁ 6 ▁ : ▁ " ) ; ret = printKDistant ( root , 6 ) ; if ( ret == false ) Console . Write ( " Number ▁ exceeds ▁ total " + " number ▁ of ▁ levels STRNEWLINE " ) ; } }
Print all leaf nodes of a Binary Tree from left to right | C # program to print leaf nodes from left to right ; A Binary Tree Node ; Function to print leaf nodes from left to right ; If node is null , return ; If node is leaf node , print its data ; If left child exists , check for leaf recursively ; If right child exists , check for leaf recursively ; Utility function to create a new tree node ; Driver code ; Let us create binary tree shown in above diagram ; Print leaf nodes of the given tree
using System ; class GFG { class Node { public int data ; public Node left , right ; } ; static void printLeafNodes ( Node root ) { if ( root == null ) return ; if ( root . left == null && root . right == null ) { Console . Write ( root . data + " ▁ " ) ; return ; } if ( root . left != null ) printLeafNodes ( root . left ) ; if ( root . right != null ) printLeafNodes ( root . right ) ; } static Node newNode ( int data ) { Node temp = new Node ( ) ; temp . data = data ; temp . left = null ; temp . right = null ; return temp ; } public static void Main ( ) { Node root = newNode ( 1 ) ; root . left = newNode ( 2 ) ; root . right = newNode ( 3 ) ; root . left . left = newNode ( 4 ) ; root . right . left = newNode ( 5 ) ; root . right . right = newNode ( 8 ) ; root . right . left . left = newNode ( 6 ) ; root . right . left . right = newNode ( 7 ) ; root . right . right . left = newNode ( 9 ) ; root . right . right . right = newNode ( 10 ) ; printLeafNodes ( root ) ; } }
Print all nodes at distance k from a given node | C # program to print all nodes at a distance k from given node ; A binary tree node ; Recursive function to print all the nodes at distance k in tree ( or subtree ) rooted with given root . ; Base Case ; If we reach a k distant node , print it ; Recur for left and right subtrees ; Prints all nodes at distance k from a given target node . The k distant nodes may be upward or downward . This function Returns distance of root from target node , it returns - 1 if target node is not present in tree rooted with root . ; Base Case 1 : If tree is empty , return - 1 ; If target is same as root . Use the downward function to print all nodes at distance k in subtree rooted with target or root ; Recur for left subtree ; Check if target node was found in left subtree ; If root is at distance k from target , print root Note that dl is Distance of root 's left child from   target ; Else go to right subtree and print all k - dl - 2 distant nodes Note that the right child is 2 edges away from left child ; Add 1 to the distance and return value for parent calls ; MIRROR OF ABOVE CODE FOR RIGHT SUBTREE Note that we reach here only when node was not found in left subtree ; If target was neither present in left nor in right subtree ; Driver program to test the above functions ; Let us construct the tree shown in above diagram
using System ; public class Node { public int data ; public Node left , right ; public Node ( int item ) { data = item ; left = right = null ; } } public class BinaryTree { public Node root ; public virtual void printkdistanceNodeDown ( Node node , int k ) { if ( node == null k < 0 ) { return ; } if ( k == 0 ) { Console . Write ( node . data ) ; Console . WriteLine ( " " ) ; return ; } printkdistanceNodeDown ( node . left , k - 1 ) ; printkdistanceNodeDown ( node . right , k - 1 ) ; } public virtual int printkdistanceNode ( Node node , Node target , int k ) { if ( node == null ) { return - 1 ; } if ( node == target ) { printkdistanceNodeDown ( node , k ) ; return 0 ; } int dl = printkdistanceNode ( node . left , target , k ) ; if ( dl != - 1 ) { if ( dl + 1 == k ) { Console . Write ( node . data ) ; Console . WriteLine ( " " ) ; } else { printkdistanceNodeDown ( node . right , k - dl - 2 ) ; } return 1 + dl ; } int dr = printkdistanceNode ( node . right , target , k ) ; if ( dr != - 1 ) { if ( dr + 1 == k ) { Console . Write ( node . data ) ; Console . WriteLine ( " " ) ; } else { printkdistanceNodeDown ( node . left , k - dr - 2 ) ; } return 1 + dr ; } return - 1 ; } public static void Main ( string [ ] args ) { BinaryTree tree = new BinaryTree ( ) ; tree . root = new Node ( 20 ) ; tree . root . left = new Node ( 8 ) ; tree . root . right = new Node ( 22 ) ; tree . root . left . left = new Node ( 4 ) ; tree . root . left . right = new Node ( 12 ) ; tree . root . left . right . left = new Node ( 10 ) ; tree . root . left . right . right = new Node ( 14 ) ; Node target = tree . root . left . right ; tree . printkdistanceNode ( tree . root , target , 2 ) ; } }
Print all nodes that don 't have sibling | C # program to print all nodes that don 't have sibling ; A binary tree node ; Function to print all non - root nodes that don 't have a sibling ; Base case ; If this is an internal node , recur for left and right subtrees ; If left child is NULL and right is not , print right child and recur for right child ; If right child is NULL and left is not , print left child and recur for left child ; Driver program to test the above functions ; Let us construct the tree shown in above diagram
using System ; public class Node { public int data ; public Node left , right ; public Node ( int item ) { data = item ; left = right = null ; } } public class BinaryTree { public Node root ; public virtual void printSingles ( Node node ) { if ( node == null ) { return ; } if ( node . left != null && node . right != null ) { printSingles ( node . left ) ; printSingles ( node . right ) ; } else if ( node . right != null ) { Console . Write ( node . right . data + " ▁ " ) ; printSingles ( node . right ) ; } else if ( node . left != null ) { Console . Write ( node . left . data + " ▁ " ) ; printSingles ( node . left ) ; } } public static void Main ( string [ ] args ) { BinaryTree tree = new BinaryTree ( ) ; tree . root = new Node ( 1 ) ; tree . root . left = new Node ( 2 ) ; tree . root . right = new Node ( 3 ) ; tree . root . left . right = new Node ( 4 ) ; tree . root . right . left = new Node ( 5 ) ; tree . root . right . left . right = new Node ( 6 ) ; tree . printSingles ( tree . root ) ; } }
Print all nodes that are at distance k from a leaf node |  ; C # program to print all nodes at a distance k from leaf A binary tree node ; This function prints all nodes that are distance k from a leaf node path [ ] -- > Store ancestors of a node visited [ ] -- > Stores true if a node is printed as output . A node may be k distance away from many leaves , we want to print it once ; Base case ; append this Node to the path array ; it 's a leaf, so print the ancestor at distance k only  if the ancestor is not already printed  ; If not leaf node , recur for left and right subtrees ; Given a binary tree and a nuber k , print all nodes that are k distant from a leaf ; Driver program to test the above functions ; Let us construct the tree shown in above diagram
using System ; public class Node { public int data ; public Node left , right ; public Node ( int item ) { data = item ; left = right = null ; } } public class BinaryTree { public Node root ; public virtual void kDistantFromLeafUtil ( Node node , int [ ] path , bool [ ] visited , int pathLen , int k ) { if ( node == null ) { return ; } path [ pathLen ] = node . data ; visited [ pathLen ] = false ; pathLen ++ ; if ( node . left == null && node . right == null && pathLen - k - 1 >= 0 && visited [ pathLen - k - 1 ] == false ) { Console . Write ( path [ pathLen - k - 1 ] + " ▁ " ) ; visited [ pathLen - k - 1 ] = true ; return ; } kDistantFromLeafUtil ( node . left , path , visited , pathLen , k ) ; kDistantFromLeafUtil ( node . right , path , visited , pathLen , k ) ; } public virtual void printKDistantfromLeaf ( Node node , int k ) { int [ ] path = new int [ 1000 ] ; bool [ ] visited = new bool [ 1000 ] ; kDistantFromLeafUtil ( node , path , visited , 0 , k ) ; } public static void Main ( string [ ] args ) { BinaryTree tree = new BinaryTree ( ) ; tree . root = new Node ( 1 ) ; tree . root . left = new Node ( 2 ) ; tree . root . right = new Node ( 3 ) ; tree . root . left . left = new Node ( 4 ) ; tree . root . left . right = new Node ( 5 ) ; tree . root . right . left = new Node ( 6 ) ; tree . root . right . right = new Node ( 7 ) ; tree . root . right . left . right = new Node ( 8 ) ; Console . WriteLine ( " ▁ Nodes ▁ at ▁ distance ▁ 2 ▁ are ▁ : " ) ; tree . printKDistantfromLeaf ( tree . root , 2 ) ; } }
Print all nodes that are at distance k from a leaf node | A binary tree node ; Given a binary tree and a nuber k , print all nodes that are k distant from a leaf ; leaf node ; parent of left leaf ; parent of right leaf ; Driver program to test the above functions ; Let us construct the tree shown in above diagram
using System ; class Node { public int data ; public Node left , right ; public Node ( int item ) { data = item ; left = right = null ; } } class BinaryTree { Node root ; int printKDistantfromLeaf ( Node node , int k ) { if ( node == null ) return - 1 ; int lk = printKDistantfromLeaf ( node . left , k ) ; int rk = printKDistantfromLeaf ( node . right , k ) ; bool isLeaf = lk == - 1 && lk == rk ; if ( lk == 0 || rk == 0 || ( isLeaf && k == 0 ) ) Console . Write ( " ▁ " + node . data ) ; if ( isLeaf && k > 0 ) return k - 1 ; if ( lk > 0 && lk < k ) return lk - 1 ; if ( rk > 0 && rk < k ) return rk - 1 ; return - 2 ; } public static void Main ( string [ ] args ) { BinaryTree tree = new BinaryTree ( ) ; tree . root = new Node ( 1 ) ; tree . root . left = new Node ( 2 ) ; tree . root . right = new Node ( 3 ) ; tree . root . left . left = new Node ( 4 ) ; tree . root . left . right = new Node ( 5 ) ; tree . root . right . left = new Node ( 6 ) ; tree . root . right . right = new Node ( 7 ) ; tree . root . right . left . right = new Node ( 8 ) ; Console . Write ( " Nodes ▁ at ▁ distance ▁ 2 ▁ are ▁ : " ) ; tree . printKDistantfromLeaf ( tree . root , 2 ) ; } }
Print leftmost and rightmost nodes of a Binary Tree | C # program to print corner node at each level in a binary tree ; A binary tree node has key , pointer to left child and a pointer to right child ; Function to print corner node at each level ; star node is for keeping track of levels ; pushing root node and star node ; Do level order traversal of Binary Tree ; n is the no of nodes in current Level ; If it is leftmost corner value or rightmost corner value then print it ; push the left and right children of the temp node ; Driver code
using System ; using System . Collections . Generic ; public class Node { public int key ; public Node left , right ; public Node ( int key ) { this . key = key ; left = right = null ; } } public class BinaryTree { Node root ; void printCorner ( Node root ) { Queue < Node > q = new Queue < Node > ( ) ; q . Enqueue ( root ) ; while ( q . Count != 0 ) { int n = q . Count ; for ( int i = 0 ; i < n ; i ++ ) { Node temp = q . Peek ( ) ; q . Dequeue ( ) ; if ( i == 0 i == n - 1 ) Console . Write ( temp . key + " ▁ " ) ; if ( temp . left != null ) q . Enqueue ( temp . left ) ; if ( temp . right != null ) q . Enqueue ( temp . right ) ; } } } public static void Main ( String [ ] args ) { BinaryTree tree = new BinaryTree ( ) ; tree . root = new Node ( 15 ) ; tree . root . left = new Node ( 10 ) ; tree . root . right = new Node ( 20 ) ; tree . root . left . left = new Node ( 8 ) ; tree . root . left . right = new Node ( 12 ) ; tree . root . right . left = new Node ( 16 ) ; tree . root . right . right = new Node ( 25 ) ; tree . printCorner ( tree . root ) ; } }
Print Binary Tree in 2 | C # Program to print binary tree in 2D ; A binary tree node ; Constructor that allocates a new node with the given data and null left and right pointers . ; Function to print binary tree in 2D It does reverse inorder traversal ; Base case ; Increase distance between levels ; Process right child first ; Print current node after space count ; Process left child ; Wrapper over print2DUtil ( ) ; Pass initial space count as 0 ; Driver code
using System ; class GFG { static readonly int COUNT = 10 ; public class Node { public int data ; public Node left , right ; public Node ( int data ) { this . data = data ; this . left = null ; this . right = null ; } } ; static void print2DUtil ( Node root , int space ) { if ( root == null ) return ; space += COUNT ; print2DUtil ( root . right , space ) ; Console . Write ( " STRNEWLINE " ) ; for ( int i = COUNT ; i < space ; i ++ ) Console . Write ( " ▁ " ) ; Console . Write ( root . data + " STRNEWLINE " ) ; print2DUtil ( root . left , space ) ; } static void print2D ( Node root ) { print2DUtil ( root , 0 ) ; } public static void Main ( String [ ] args ) { Node root = new Node ( 1 ) ; root . left = new Node ( 2 ) ; root . right = new Node ( 3 ) ; root . left . left = new Node ( 4 ) ; root . left . right = new Node ( 5 ) ; root . right . left = new Node ( 6 ) ; root . right . right = new Node ( 7 ) ; root . left . left . left = new Node ( 8 ) ; root . left . left . right = new Node ( 9 ) ; root . left . right . left = new Node ( 10 ) ; root . left . right . right = new Node ( 11 ) ; root . right . left . left = new Node ( 12 ) ; root . right . left . right = new Node ( 13 ) ; root . right . right . left = new Node ( 14 ) ; root . right . right . right = new Node ( 15 ) ; print2D ( root ) ; } }
Print Left View of a Binary Tree | C # program to print left view of binary tree ; Class containing left and right child of current node and key value ; Class to print the left view ; recursive function to print left view ; Base Case ; If this is the first node of its level ; Recur for left and right subtrees ; A wrapper over leftViewUtil ( ) ; testing for example nodes
using System ; public class Node { public int data ; public Node left , right ; public Node ( int item ) { data = item ; left = right = null ; } } public class BinaryTree { public Node root ; public static int max_level = 0 ; public virtual void leftViewUtil ( Node node , int level ) { if ( node == null ) { return ; } if ( max_level < level ) { Console . Write ( " ▁ " + node . data ) ; max_level = level ; } leftViewUtil ( node . left , level + 1 ) ; leftViewUtil ( node . right , level + 1 ) ; } public virtual void leftView ( ) { leftViewUtil ( root , 1 ) ; } public static void Main ( string [ ] args ) { BinaryTree tree = new BinaryTree ( ) ; tree . root = new Node ( 12 ) ; tree . root . left = new Node ( 10 ) ; tree . root . right = new Node ( 30 ) ; tree . root . right . left = new Node ( 25 ) ; tree . root . right . right = new Node ( 40 ) ; tree . leftView ( ) ; } }
Print Left View of a Binary Tree | C # program to print left view of Binary Tree ; Binary tree node ; function to print left view of binary tree ; number of nodes at current level ; Traverse all nodes of current level ; Print the left most element at the level ; Add left node to queue ; Add right node to queue ; Driver code ; construct binary tree as shown in above diagram
using System ; using System . Collections . Generic ; public class PrintRightView { private class Node { public int data ; public Node left , right ; public Node ( int data ) { this . data = data ; this . left = null ; this . right = null ; } } private static void printRightView ( Node root ) { if ( root == null ) return ; Queue < Node > queue = new Queue < Node > ( ) ; queue . Enqueue ( root ) ; while ( queue . Count != 0 ) { int n = queue . Count ; for ( int i = 1 ; i <= n ; i ++ ) { Node temp = queue . Dequeue ( ) ; if ( i == n ) Console . Write ( temp . data + " ▁ " ) ; if ( temp . left != null ) queue . Enqueue ( temp . left ) ; if ( temp . right != null ) queue . Enqueue ( temp . right ) ; } } } public static void Main ( String [ ] args ) { Node root = new Node ( 10 ) ; root . left = new Node ( 2 ) ; root . right = new Node ( 3 ) ; root . left . left = new Node ( 7 ) ; root . left . right = new Node ( 8 ) ; root . right . right = new Node ( 15 ) ; root . right . left = new Node ( 12 ) ; root . right . right . left = new Node ( 14 ) ; printRightView ( root ) ; } }
Reduce the given Array of [ 1 , N ] by rotating left or right based on given conditions | C # program for the above approach ; Function to find the last element left after performing N - 1 queries of type X ; Stores the next power of 2 ; Iterate until nextPower is at most N ; If X is equal to 1 ; Stores the power of 2 less than or equal to N ; Return the final value ; Driver Code
using System ; using System . Collections . Generic ; class GFG { static int rotate ( int [ ] arr , int N , int X ) { int nextPower = 1 ; while ( nextPower <= N ) nextPower *= 2 ; if ( X == 1 ) return nextPower - N ; int prevPower = nextPower / 2 ; return 2 * ( N - prevPower ) + 1 ; } public static void Main ( ) { int [ ] arr = { 1 , 2 , 3 , 4 , 5 } ; int X = 1 ; int N = arr . Length ; Console . Write ( rotate ( arr , N , X ) ) ; } }
Maximum number of 0 s placed consecutively at the start and end in any rotation of a Binary String | C # program for the above approach ; Function to find the maximum sum of consecutive 0 s present at the start and end of a string present in any of the rotations of the given string ; Check if all the characters in the string are 0 ; Iterate over characters of the string ; If the frequency of '1' is 0 ; Print n as the result ; Concatenate the string with itself ; Stores the required result ; Generate all rotations of the string ; Store the number of consecutive 0 s at the start and end of the string ; Count 0 s present at the start ; Count 0 s present at the end ; Calculate the sum ; Update the overall maximum sum ; Print the result ; Driver Code ; Given string ; Store the size of the string
using System ; class GFG { static void findMaximumZeros ( string str , int n ) { int c0 = 0 ; for ( int i = 0 ; i < n ; ++ i ) { if ( str [ i ] == '0' ) c0 ++ ; } if ( c0 == n ) { Console . Write ( n ) ; return ; } string s = str + str ; int mx = 0 ; for ( int i = 0 ; i < n ; ++ i ) { int cs = 0 ; int ce = 0 ; for ( int j = i ; j < i + n ; ++ j ) { if ( s [ j ] == '0' ) cs ++ ; else break ; } for ( int j = i + n - 1 ; j >= i ; -- j ) { if ( s [ j ] == '0' ) ce ++ ; else break ; } int val = cs + ce ; mx = Math . Max ( val , mx ) ; } Console . Write ( mx ) ; } public static void Main ( string [ ] args ) { string s = "1001" ; int n = s . Length ; findMaximumZeros ( s , n ) ; } }
Maximum number of 0 s placed consecutively at the start and end in any rotation of a Binary String | C # program for the above approach ; Function to find the maximum sum of consecutive 0 s present at the start and end of any rotation of the string str ; Stores the count of 0 s ; If the frequency of '1' is 0 ; Print n as the result ; Stores the required sum ; Find the maximum consecutive length of 0 s present in the string ; Update the overall maximum sum ; Find the number of 0 s present at the start and end of the string ; Update the count of 0 s at the start ; Update the count of 0 s at the end ; Update the maximum sum ; Print the result ; Driver Code ; Given string ; Store the size of the string
using System ; class GFG { static void findMaximumZeros ( string str , int n ) { int c0 = 0 ; for ( int i = 0 ; i < n ; ++ i ) { if ( str [ i ] == '0' ) c0 ++ ; } if ( c0 == n ) { Console . Write ( n ) ; return ; } int mx = 0 ; int cnt = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( str [ i ] == '0' ) cnt ++ ; else { mx = Math . Max ( mx , cnt ) ; cnt = 0 ; } } mx = Math . Max ( mx , cnt ) ; int start = 0 , end = n - 1 ; cnt = 0 ; while ( str [ start ] != '1' && start < n ) { cnt ++ ; start ++ ; } while ( str [ end ] != '1' && end >= 0 ) { cnt ++ ; end -- ; } mx = Math . Max ( mx , cnt ) ; Console . Write ( mx ) ; } static public void Main ( ) { string s = "1001" ; int n = s . Length ; findMaximumZeros ( s , n ) ; } }
Modify a string by performing given shift operations | C # implementataion of above approach ; Function to find the string obtained after performing given shift operations ; If shift [ i , 0 ] = 0 , then left shift Otherwise , right shift ; Stores length of the string ; Effective shift calculation ; Stores modified string ; Right rotation ; Left rotation ; Driver Code
using System ; public class GFG { static void stringShift ( String s , int [ , ] shift ) { int val = 0 ; for ( int i = 0 ; i < shift . GetLength ( 0 ) ; ++ i ) if ( shift [ i , 0 ] == 0 ) val -= shift [ i , 1 ] ; else val += shift [ i , 1 ] ; int len = s . Length ; val = val % len ; String result = " " ; if ( val > 0 ) result = s . Substring ( len - val , val ) + s . Substring ( 0 , len - val ) ; else result = s . Substring ( - val , len ) + s . Substring ( 0 , - val ) ; Console . WriteLine ( result ) ; } public static void Main ( String [ ] args ) { String s = " abc " ; int [ , ] shift = new int [ , ] { { 0 , 1 } , { 1 , 2 } } ; stringShift ( s , shift ) ; } }