Given two strings. The task is to find the larger string without using built-in functions.
Examples:
Input:
GeeksforGeeks
Geeks
Output:
GeeksforGeeks
Input:
GeeksForFeeks is an good Computer Coding Website
It offers several topics
Output:
GeeksForFeeks is an good Computer Coding Website
Step-by-step Approach:
Below is the complete program based on the above approach:
string1="GeeksForFeeks is an good Computer Coding Website " string2="It offers several topics" count1=0 count2=0 for i in string1: count1=count1+1 for j in string2: count2=count2+1 if(count1<count2): print("Larger string is:") print(string2) elif(count1==count2): print("Both strings are equal.") else: print("Larger string is:") print(string1)
Output
Larger string is: GeeksForFeeks is an good Computer Coding Website
Program Explanation :
Australia
UK
UAE
Singapore
Canada
New
Zealand
Malaysia
USA
India
South
Africa
Ireland
Saudi
Arab
Qatar
Kuwait
Hongkong
Copyright 2016-2023 www.programmingshark.com - All Rights Reserved.
Disclaimer : Any type of help and guidance service given by us is just for reference purpose. We never ask any of our clients to submit our solution guide as it is, anywhere.