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. Android刷机教程

    我的机器是Nexus 5 一. 安装驱动 如何进入fastboot模式 1. 拔掉数据线,将手机关机 2. 关机后同时按住[音量减小键]和[开关机键]即可进入Fastboot模式 开启usb调试  - ...

  2. block、inline、inline-block

    block: block - 块级元素 常见的块级元素包括:div,form,p,table,ul,ol,dl,h1~h6,pre block 可以包含 inlne 和 block 和 inline- ...

  3. MySQL 编译安装并且开启DEBUG模式

    因为想分析下mysql中一些操作的内部执行过程,单纯的看源码太枯燥了,所以决定结合mysql的执行过程来分析,mysql作为一款成熟的数据库软件,在设计的时候就考虑到了调试的问题,只是想开启调试模式的 ...

  4. Asp.net中导出Excel文档(Gridview)

    主要思路,通过GridView来导出文档. 新建一个Aspx页面,页面创建GridView控件,后台绑定好数据源.然后load中直接打印即可导出 前台的GridView <asp:GridVie ...

  5. 转载:稀疏矩阵存储格式总结+存储效率对比:COO,CSR,DIA,ELL,HYB

    http://www.cnblogs.com/xbinworld/p/4273506.html 稀疏矩阵是指矩阵中的元素大部分是0的矩阵,事实上,实际问题中大规模矩阵基本上都是稀疏矩阵,很多稀疏度在9 ...

  6. 函数图象(N=x+y*i)

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...

  7. alias实现命令别名

    需要经常进入/srv/www/app/account这个目录,每次都得重复的输入这一长串路径进入该目录,显得麻烦而费时,因此可以将"cd /srv/www/app/account" ...

  8. Tastypie 学习笔记

    Tastypie是什么? 运行于Python环境中的 Django web服务器下的 Restful 风格API接口  (python 类库) 1.安装下面环境或者依赖包到python库(安装过程类似 ...

  9. 数位DP BZOJ 1026 [SCOI2009]windy数

    题目链接 前面全是0的情况特判 #include <bits/stdc++.h> int dp[10][10]; int digit[10]; int DFS(int pos, int v ...

  10. 数论 - Pairs(数字对)

    In the secret book of ACM, it’s said: “Glory for those who write short ICPC problems. May they live ...