HackerRank - "Building a Smart IDE: Identifying comments"

import re

import io
import sys
input_stream = io.TextIOWrapper(sys.stdin.buffer, encoding=‘utf-8‘)

s = input_stream.readlines()
s = "\n".join(s)

pc = ‘(//.*|/\*[\d\D]*?\*/)‘
mc = re.findall(pc, s)
for v in mc:
    vs = v.split("\n\n")
    for l in vs:
        print (l.lstrip())
时间: 2024-07-31 11:19:42

HackerRank - "Building a Smart IDE: Identifying comments"的相关文章

HackerRank - "Building a Smart IDE: Programming Language Detection"

So fun! It connects algorithm(regex) with real world usages! So basically speaking, C:pointer syntax, #include\scanf\typedef; Java: import\public class syntax\try-catch syntax; Python: def syntax\special print syntax. And BTW, if you are working on r

C++ Core Guidelines

C++ Core Guidelines September 9, 2015 Editors: Bjarne Stroustrup Herb Sutter This document is a very early draft. It is inkorrekt, incompleat, and pµøoorly formatted. Had it been an open source (code) project, this would have been release 0.6. Copy

The Modern JavaScript Developer’s Toolbox

The Modern JavaScript Developer’s Toolbox Posted by David Haney on Mar 09, 2015 The Web Platform has gone a long way since HTML5 was first made popular and people started looking into JavaScript as a language that could do build complex apps. Many AP

[C1] Andrew Ng - AI For Everyone

About this Course AI is not only for engineers. If you want your organization to become better at using AI, this is the course to tell everyone--especially your non-technical colleagues--to take. In this course, you will learn: The meaning behind com

转载:NetBeans中如何运行GUI

这篇入门教程将教会您怎样创建一个简单的人机交互界面以及向其中添加简单 的后台功能. 特别地,我们将向您展示如何按 Swing 规范编写控制按钮和域代 码. 我们将会使用到布局管理.设计简单 GUI 界面以及添加一些“按钮(button) ”和“文本字段(text field)”组件. “文本字段”是用来接收输入和显示输出 的,“按钮”在前端用来起动相应功能. 我们将创建的应用程序会是一个简单但 实用的计算器. 获得更多GUI设计功能.视频及文档,请参见Desgning a Swing GUI i

物联网环境下的中小城市智慧社区建设研究

[中文摘要]信息化大潮下的第三波浪潮----智慧地球,已经逐渐开始席卷全球,很多欧美国家都纷纷拥抱"智慧地球"这个美丽的新生事物.作为智慧地球概念最终落到实处的重要一环----智慧社区----的建设也被提到了历史日程上来.国内外不少国家和发达地区的社区都已经开始进行了智慧社区建设,并且取得的初步的经验和良好的效果.文章从政策.经济.人才.标准制定等方面,对目前智慧社区建设中存在和可能存在的问题,进行了详细的分析论述,并在论述基础上提出了相应的策略意见,为中小城市的智慧社区建设提供一些参

模块——Getopt::Long接收客户命令行参数和Smart::Comments输出获得的命令行参数内容

转载:http://www.php-oa.com/2009/04/04/perl_getopt-long.html  我们在linux常常用到一个程序需要加入参数,现在了解一下 perl 中的有关控制参数的模块 Getopt::Long ,比直接使用 @ARGV 的数组强大多了.我想大家知道在 Linux 中有的参数有二种形式. 长参数  –help 短参数   -h 也就是-和–的分别.–表示完整参数.-表示简化参数.在 Perl 的这个模块中也支持这二种方法.这要介绍的二 Getopt 其实

[Perl] Smart::Comments

调试Perl程序时,使用Smart::Comment模块,追踪代码的变量值,非常方便有效. 代码示例: 1 #!/usr/bin/perl 2 3 use Smart::Comments; 4 # no Smart::Comments;5 my $var=@ARGV[0]; 6 7 ### $var; 执行代码: ./smartcomment.pl test 执行结果: ### $var: 'test' 使用“no Smart::Comments” 代替 “use Smart::Comments

Building Python 2.7.10 with Visual Studio 2010 or 2015 - Google Chrome

您的浏览器(Chrome 33) 需要更新.该浏览器有诸多安全漏洞,无法显示本网站的所有功能.?了解如何更新浏览器 × p-nand-q.com C++? Python? Programming? Languages? Humor? Tools? Misc? Building Python 2.7.10 with Visual Studio 2010 or 2015 7th revision, August 7, 2015.A document history can be found at t