A. Kyoya and Photobooks

Time Limit: 2000ms
Memory Limit: 262144KB

64-bit integer IO format: %I64d      Java class name: (Any)

Kyoya Ootori is selling photobooks of the Ouran High School Host Club. He has 26 photos, labeled "a" to "z", and he has compiled them into a photo booklet with some photos in some order (possibly with some photos being duplicated). A photo booklet can be described as a string of lowercase letters, consisting of the photos in the booklet in order. He now wants to sell some "special edition" photobooks, each with one extra photo inserted anywhere in the book. He wants to make as many distinct photobooks as possible, so he can make more money. He asks Haruhi, how many distinct photobooks can he make by inserting one extra photo into the photobook he already has?

Please help Haruhi solve this problem.

 

Input

The first line of input will be a single string s (1 ≤ |s| ≤ 20). String s consists only of lowercase English letters.

 

Output

Output a single integer equal to the number of distinct photobooks Kyoya Ootori can make.

 

Sample Input

Input
a
Output
51
Input
hi
Output
76

Hint

In the first case, we can make 'ab','ac',...,'az','ba','ca',...,'za', and 'aa', producing a total of 51 distinct photo booklets.

题目大意:有一个英文字符串,问加一个字母,字符串有几种不同的样子。

思路:遍历一遍。记录一下一共有多少个a,b,c,d.....假设一共有n个a,那这个字符串插入a的话,插入在a的左边和插入a的右边是一样,假设字符串一共有len个字符,那一共有len+1个可以放,减去重复的  一共有len+1-s[i],s[i]表示第i个英文字母的个数   累加即可

代码:

#include <stdio.h>
#include <iostream>
#include <string.h> using namespace std; int main(){
char s[];
int len;
int ans=;
int num[]={};
cin>>s;
len = strlen(s);
for(int i=;i<len;i++)
num[s[i]-'a']++;
for(int i=;i<;i++)
ans+=(len-num[i]+);
cout<<ans<<endl; }

Codeforces554A:Kyoya and Photobooks的更多相关文章

  1. Codeforces Round #309 (Div. 2) A. Kyoya and Photobooks 字符串水题

    A. Kyoya and Photobooks Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/5 ...

  2. A. Kyoya and Photobooks(Codeforces Round #309 (Div. 2))

    A. Kyoya and Photobooks   Kyoya Ootori is selling photobooks of the Ouran High School Host Club. He ...

  3. 找规律 Codeforces Round #309 (Div. 2) A. Kyoya and Photobooks

    题目传送门 /* 找规律,水 */ #include <cstdio> #include <iostream> #include <algorithm> #incl ...

  4. Codeforces Round #309 (Div. 2) A. Kyoya and Photobooks【*组合数学】

    A. Kyoya and Photobooks time limit per test 2 seconds memory limit per test 256 megabytes input stan ...

  5. 【76.83%】【codeforces 554A】Kyoya and Photobooks

    time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...

  6. Codeforces Round #309 (Div. 2)

    A. Kyoya and Photobooks Kyoya Ootori is selling photobooks of the Ouran High School Host Club. He ha ...

  7. Codeforces554 C Kyoya and Colored Balls

    C. Kyoya and Colored Balls Time Limit: 2000ms Memory Limit: 262144KB 64-bit integer IO format: %I64d ...

  8. codeforces 553A . Kyoya and Colored Balls 组合数学

    Kyoya Ootori has a bag with n colored balls that are colored with k different colors. The colors are ...

  9. Codeforces Round #309 (Div. 1) B. Kyoya and Permutation 构造

    B. Kyoya and Permutation Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/ ...

随机推荐

  1. 生成解决方案,主项目的bin目录下没有其他项目生成的dll

    问题说明: 我的项目组成: 主项目为:TaskUtlity 在生成解决方案的时候在TaskUtlity的bin目录下老是找不到ProBonus项目生成的dll. 解决方案: 1.打开sln文件,找到P ...

  2. jstl 简单实践

    <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"% ...

  3. c/c++ string.h

    操作数的都是 ( char * )型,操作时不考虑末尾的'\0',操作数必须是指向字符串的指针("a"),不能是字符('a'). size_t strlen( const char ...

  4. Android 动态生成 EditTest

    这几天,开始一个项目,需要一个小效果,就是一个输入邮箱地址的EditTest 需要动态的添加.默认有两个,然后最多5个,手机的屏幕总是有限的 好的 ,这就上代码了 布局文件 <LinearLay ...

  5. 摇一摇js 实现

    if (window.DeviceMotionEvent) { window.addEventListener('devicemotion',deviceMotionHandler, false); ...

  6. LeetCode之283. Move Zeroes

    ---------------------------------------------------------------------- 解法一:空间换时间 我使用的办法也是类似于"扫描 ...

  7. 工欲善其事-Eclipse设置

    1.注释设置 [重要可以保存使用] 在菜单栏Window--->Preferences--->Java--->Code Style--->Code Templates然后展示C ...

  8. 用JMeter进行Performance Test

    用JMeter可以对Http请求进行Performance Test,来分析哪些方法花费的时间多,哪些方法花费的时间少,有了这样的分析结果后,我们就可以集中力量来改进费时的方法. 官方文档请参考如下链 ...

  9. cas单点登录时报Invalid credentials

    CAS4后默认的密码验证不是简单的相同了.在配置文件deployerConfigContext.xml里可以找到, 默认是 Username:casuser Password:Mellon

  10. DELL灵越15R5521安装黑苹果

    按照网上的流程安装即可:(懒人法) 首先分出两个硬盘分区,一个10G左右(用于做系统),一个30G左右(用于装系统)://注意生成时选择不要格式化 然后利用硬盘助手将镜像文件(.cdr文件)写入10G ...