Given a string of length L. The task is to convert the string into a grid.
Input : str = "haveaniceday" Output : have anic eday Explanation: k is the separator. If k is 4 then the output will be "have anic eday" Input :str = "geeksforgeeks" Output : geek sfor geek s
Note: & l = length of the string
- Without using an inbuit function
- Make a 2d character array of (rows * column) size.
- Assign the value K which is a column value.
- Print the 2d character array.
Below is the implementation of the above approach.
GEEK SFOR GEEK S
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Minimum cost to convert 3 X 3 matrix into magic square
- Minimum number of steps to convert a given matrix into Upper Hessenberg matrix
- Minimum steps required to convert the matrix into lower hessenberg matrix
- Minimum number of steps to convert a given matrix into Diagonally Dominant Matrix
- Convert given Matrix into sorted Spiral Matrix
- Count of ungrouped characters after dividing a string into K groups of distinct characters
- Python | Convert a list of characters into a string
- Maximum perimeter of a square in a 2D grid
- Search a Word in a 2D Grid of characters
- Transform string str1 into str2 by taking characters from string str3
- Convert the string into palindrome string by changing only one character.
- Check if matrix can be converted to another matrix by transposing square sub-matrices
- Construct a square Matrix whose parity of diagonal sum is same as size of matrix
- Shortest distance between two cells in a matrix or grid
- Program to convert given Matrix to a Diagonal Matrix
- C++ program to Convert a Matrix to Sparse Matrix
- Minimize count of adjacent row swaps to convert given Matrix to a Lower Triangular Matrix
- Number of ways to insert two pairs of parentheses into a string of N characters
- Remove minimum characters from string to split it into three substrings under given constraints
- Check if a string can be split into two strings with same number of K-frequent characters
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : AnkitRai01, Rajput-Ji, princiraj1992, Mithun Kumar, hemantsonirbz, more