Building a Smart IDE: Programming Language Detection – HackerRank Solution

In this post, we will solve Building a Smart IDE: Programming Language Detection HackerRank Solution. This problem (Building a Smart IDE: Programming Language Detection) is a part of HackerRank Regex series.

Solution – Building a Smart IDE: Programming Language Detection – HackerRank Solution

Python

import re
import sys

class Main:
    def __init__(self):
        self.s = ''.join(sys.stdin.readlines())
        
    def output(self):
        if 'java' in self.s:
            print("Java")
        elif '#include' in self.s:
            print("C")
        else:
            print("Python")
        
if __name__ == '__main__':
    obj = Main()
    obj.output()

Note: This problem (Building a Smart IDE: Programming Language Detection) is generated by HackerRank but the solution is provided by CodingBroz. This tutorial is only for Educational and Learning purpose.

Leave a Comment

Your email address will not be published. Required fields are marked *