现在的位置: 首页 > 综合 > 正文

Hackerrank Pangrams

2018年02月20日 ⁄ 综合 ⁄ 共 339字 ⁄ 字号 评论关闭

简单题 

#include  <iostream>
#include  <string>
#include  <cctype>
using namespace std ;

int main()
{
	string s ;
	getline(cin ,s );
	int count[26]={0};
	int len = s.size();
	bool flag =  true ;
	for ( int i = 0 ; i < s.size();++i)
	{
	
	         s[i] = tolower(s[i]);
	         count[s[i]-'a']++;
	}
	for ( int i = 0 ; i < 26 ; ++i)
	        if (count[i] == 0) 
	        {
	        	 flag = false ;
	        	 break;
	        }
	if (flag) cout << "pangram" << endl ;
	else cout << "not pangram " << endl ;
	return 0 ;
}

【上篇】
【下篇】

抱歉!评论已关闭.