About Me

About Me : I have been working as a Software Engineer for various international companies for four years.Currently, I am working as a full stack Javascript developer in Petronas(Malaysia).

Skills

Skills • Javascript •Typescript •Python •C •Java •ReactJs • Redux • VueJs • NestJs • React Testing Library • Django• PostgreSQL • MySQL • NodeJs • Git • Docker • Jira • Visual Studio Code • Slack

শুক্রবার, ১২ জুন, ২০১৫

Timus Solution :1567. SMS-spam

#include <bits/stdc++.h>
#define ll long long
#define scd(a,b) scanf("%d %d",&a,&b)
#define sc(a) scanf("%d",&a)

using namespace std;

int main()
{
   // freopen("in.txt","r",stdin);
    map<char,int>mp;
    for(int i=1,j=97,k=98,l=99; i<=9; i++,j+=3,k+=3,l+=3)
    {
        char x=(char)j;
        mp[x]=1;
        char y=(char)k;
        mp[y]=2;
        char z=(char)l;
        if(i<9) mp[z]=3;

    }
    mp['.']=1;
    mp[',']=2;
    mp['!']=3;
    mp[' ']=1;
   // mp['#']=2;
    string str;
    getline(cin,str);
    int sum=0;
    for(int i=0; i<(int)str.size(); i++)
    {

      if(str[i]!='#')  sum+=mp[str[i]];

    }
    cout<<sum<<endl;

    return 0;
}

কোন মন্তব্য নেই:

একটি মন্তব্য পোস্ট করুন