Longest substring of only 4's from the first N characters of the infinite string
Given an integer N, the task is to find the length of the longest substring containing only 4's from the first N characters of the infinite string str.The string str is generated by concatenating the numbers formed by only 4's and 5's in increasing order. For example 4, 5, 44, 45, 54, 55 and so on.