1 solutions
-
0
C++ :
#include<bits/stdc++.h> using namespace std; int ans=0,a[27]={1,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,4,1,2,3,1,2,3,4}; int main() { string s; getline(cin,s); for(int i=0;i<s.size();i++) { if(s[i]==' ') ans++; else ans+=a[s[i]-96]; } cout<<ans; return 0; }Pascal :
var n,i,l:longint; s1:string; begin readln(s1); l:=length(s1); for i:=1 to l do begin case s1[i] of 'a','d','g','j','m','p','t','w',' ':n:=n+1; 'b','e','h','k','n','q','u','x':n:=n+2; 'c','f','i','l','o','r','v','y':n:=n+3; 's','z':n:=n+4; end; end; write(n); end.
- 1
Information
- ID
- 17818
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By